0% found this document useful (0 votes)
131 views1 page

C++ Final Exam

This document contains instructions for a C++ programming final exam with 5 questions worth a total of 100 points. Question 1 asks students to outline the 5 steps of the engineering problem-solving methodology to develop a C++ program to calculate a salesperson's earnings based on commissions from various items sold. Question 2 asks students to write the complete C++ program for question 1. Question 3 asks students to again outline the 5 steps to develop a function to display a square of a given character and size at the left margin of the screen, and for the main function to call this function. Question 4 asks students to write the complete C++ program for question 3. Question 5 provides blanks for basic C++ terms.

Uploaded by

Naeem Gul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
131 views1 page

C++ Final Exam

This document contains instructions for a C++ programming final exam with 5 questions worth a total of 100 points. Question 1 asks students to outline the 5 steps of the engineering problem-solving methodology to develop a C++ program to calculate a salesperson's earnings based on commissions from various items sold. Question 2 asks students to write the complete C++ program for question 1. Question 3 asks students to again outline the 5 steps to develop a function to display a square of a given character and size at the left margin of the screen, and for the main function to call this function. Question 4 asks students to write the complete C++ program for question 3. Question 5 provides blanks for basic C++ terms.

Uploaded by

Naeem Gul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 1

ENGR 2230 ENGINEERING PROGRAMMING SPRING 2020

APRIL 29, 2020 FINAL 100 POINTS


GOOD LUCK SHOW ALL YOUR WORK DR. HONG

# 1 Based on the engineering problem-solving methodology, write down the detailed 5 steps
that are applied for developing a C++ program to calculate salesperson’s earnings: A large
company pays its salesperson on a commission basis. The list of the items sold by
salespersons is
Item Value
1 10
2 20
3 30
The salesperson receive $200 per week plus 9% of their gross sales for that week. For
example, if a salesperson sells 100 item 1 and 200 item 3 in a week, he receives
$200 + 9% × (100 × $10 + 200 × $30) = $830
There is no limit to the number of items that can be sold. The salespersons weekly sales data
may look like: 100 item 1 and 200 item 3 on Monday, 50 item 2 on Tuesday, 100 item 1 and
200 item 2 on Wednesday, and so on. Use structured input loop to enter the salespersons
weekly sale. Use switch statement to determine the value for the corresponding item. Use
either pseudo-code or flow chart to describe your algorithm. 25

# 2 Write a complete C++ program for question 1 (Include comments in your program) 25

#3 Develop a module chart and use the engineering problem-solving methodology to write
down the detailed 5 steps for the following C++ program: first, develop a function that
displays at the left margin of the screen a solid square. The square is formed of whatever
character entered by the user. The size of the square is also entered by the user. For example,
if the user entered ‘%’ as the character and ‘3’ as the size. The function should print the
following
%%%
%%%
%%%
This function is then called by the main function which reads the character and size from the
user. Use either pseudo-code or flow chart to describe your algorithm. 30

# 4 Write a complete C++ program for question 3 (Include comments in your program) 20

# 5 (Not required, bonus credit) Fill in the blanks in each of the following 10
a) Every C++ program begins execution at the function .
b) All programs can be written in terms of three types of control structures: , , and .
c) A(n) allows the compiler to check the number, types and order of the
arguments passed to a function

You might also like