Question: Using python Exercisel Suppose you have been asked to write a program that calculates a 10 percent sales commission for several sales- persons. Although it
Exercisel Suppose you have been asked to write a program that calculates a 10 percent sales commission for several sales- persons. Although it would not be a good design, one approach would be to write the code to calculate one sales- person's commission, and then repeat that code for each salesperson. A better way is to use loop The following program shows how we might use a while loop to write the commission calculating program: COMPIT105s2Lab2 File EditFormat Run Options Window Help # Th15 program calculates ales commissions # create a variable to control the loop keep_goingy # Calculate a serie of commis os while keep_going # Get a salesperson's sales and commission rate sales-float (input ('Enter the amount of sales: comm rate -float (input('Enter the commission rate: ') # Calculate the commission commission -sales comm zate # Display the commission print ('The commission iS format (comission, . , . 2 f . ) , sep-.. ) # see if the user wants to do another one keep_going input ('Do you want to calculate another+\ commission (Enter y tor yes): Enter the amountf 5&les: 10000.00 Enter the commission rate: 0.10 The commission is 1,000.00 Do you want to calculate another commission (Enter y for yes): y Enter the amount of sales: 15000 Enter the commission rate: 0.15 The commission is $2,250.00 Do you want to calculate another commission (Enter y for yes): |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
