In: Computer Science
A company pays its salespeople on a commission basis. The salespeople are paid $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of merchandise in a week is paid $200 plus 9% of $5000, for a weekly pay of $650.
Create an application that uses a for loop to input each sales person’s gross sales for the week, and calculates and displays that sales person’s weekly pay. Process one sales person’s figures at a time. In the end, print out the weekly total sales and total pay for all company salespeople. All output values should be labeled and formatted to include a dollar sign and two decimal digits (i.e., dollars and cents). Skip lines in the output to separate data for each person and to separate the totals from the individual data.
Here is a pseudocode definition of the program requirements:
Initialize variables used to accumulate company totals for sales and weekly pay
Prompt the user to enter the number of salespersons to be processed
For each salesperson
Prompt the user to enter the weekly sales for that person Calculate and display and display the weekly pay for that person
Update variables used to accumulate company totals for sales and weekly pay
Display company totals for sales and weekly pay
Here is a sample test run of the application: sales commission calculator
Enter the number of salespersons: 2
Enter sales in dollars for sales person 1: 5000
Weekly pay is $650.00
Enter sales in dollars for sales person 2: 7500
Weekly pay is $875.00
Total weekly sales: $12500.00
Total weekly pay: $1525.00
THIS IS IN PYTHON
n=int(input('Enter the number of salespersons: '))
totalSales=0
totalPay=0
for i in range(0,n):
sales=float(input('Enter sales in dollars for sales person
'+str((i+1))+': '))
print('Weekly pay is ${0:.2f}'.format(200+(0.09*sales)))
totalSales=totalSales+sales
totalPay=totalPay+(200+(0.09*sales))
print('Total weekly sales: ${0:.2f}'.format(totalSales))
print('Total weekly pay: ${0:.2f}'.format(totalPay))