Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi can someone please help me create a c++ program for this started it but still confused thanks. Plan and Create In this lab, you
Hi can someone please help me create a c++ program for this started it but still confused thanks.
Plan and Create In this lab, you will plan and create an vorithm that displays a 10% commission on a sales amount. The problem specificat is shown in Figure 3-16. Problem specification Boughton Inc. wants a program that calculates and displays the amount of a salesperson's commission. The commission is calculated by multiplying the salesperson's sales amount by 10%. Figure 3-16 Problem specification for Lab 32 First, analyze the problem, looking for the output first and then for the input. Recall that the output answers the question What does the user want to see displayed on the sereen, printed on paper, or stored in a file?, and the input answers the question What information will the computer need to know to display, print, or store the output items? In this case, the user wants to see the commission amount displayed on the screen. To do this, the computer will need to know the commission rate and the sales amount. The sales amount will beentered by the usn, whereas the problem specification indicates that the value to use for the commission rate is 10%6. Figure 3-17 shows the input and output items entered in an IPO chart. Figure 3-17 Partially completed IPO chart showing the input and output items After determining a problem's output and input, you then plan its algorithm. Recall that most algorithms begin with an instruction to enter the input items into the computer, followed by instructions that process the input items, typically including the items in one or more calculations. Most algorithms end with one or more instructions that display, print, or store the output items. Figure 3-18 shows the completed 1PO chazt for the commission problem. Figure 3-18 Completed IPO chart for Lab 3-2 After completing the IPO chart, you then move on to the third step in the problem-solving process, which is to desk-check the algorithm. You begin by choosing a set of sample data for the input values. You then use the values to manually compute the expected output. You will desk-check the current algorithm twice: first using $1328.50 as the sales amount and then using $267.90. For the first desk-check, t/ commission should be \$132.85; for the second desk-check, it should be \$26.79. The manual ca 1 -tions for both desk-checks are shown in Figure 3-19: Figure 3-19 Manual commission calculation tor the two desk checks Next, you create a desk-check table that contains one column for each input, processing, and output ikem. You then begin desk-checking the algorithm. Figure 3-20 shows the completed desk-check table. Notice that the amounts in the commission column agree with the results of the manual calculations shown in Figure 3-19. Figure 3-20 Completed deskecheck table for Lab 3.2 After desk-checking an algorithm to ensure that it works correctly, you can begin coding it. You begin by declaring memory locations that will store the values of the input, processing (if ary), and output items. The commission problem will need three memory locations to store the commission rate, sales amount, and commission. The sales amount and commission should be stored in variables because the user should be allowed to change the sales amount, which then will change the commission, while the program is running. The commission rate, howeyec will be stored in a named constant beeause its value should not change during runtime. The variables and named constant will store real numbers, so you will use the double data type for each one. Figure 3-21 shows the input, processing and output items from the IPO chart, along. with the corresponding Ct+ statements. Figure 3-21 IPO chart information and C++instructions for Lab 3-2 (. Modify. Modify the IPO chart shown earlier in Figure 3-18 so that it allows the user to enter the commission rate. Then makethe appropriate modifications to Figure 3-21. Eint main() \{ cin "Comission rate"; //user must enter const double Comm_Rate =0.1; cin "sales amount"; // user must enter the sales amount of commigsion cout constant char "Sales Anount" " " "Commission rate" = "Comgission"; cin > "Finstdesk check" =1328.50 cin "SecondDesk check " =267.90 cout const double "Firstdesk check" * .1 = 132. 855; // use once then stop cout const double "SecondDesk desk" = 26.79 cout ss double commission =0.0; return 0 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started