Print Friendly and PDF
(Sales Commission Calculator) A large company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of chemicals in a week receives $200 plus 9% of $5000, or a total of $650. Develop a C++ program that uses a while statement to input each salesperson’s gross sales for last week and calculates and displays that salesperson’s earnings. Process one salesperson’s figures at a time. Enter sales in dollars (­1 to end): 5000.00 Salary is: $650.00 Enter sales in dollars (­1 to end): 6000.00 Salary is: $740.00 Enter sales in dollars (­1 to end): 7000.00 Salary is: $830.00 Enter sales in dollars (­1 to end): ­1 Solution:
(Sales Commission Calculator) A large company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of chemicals in a week receives $200 plus 9% of $5000, or a total of $650. Develop a C++ program that uses a while statement to input each salesperson’s gross sales for last week and calculates and displays that salesperson’s earnings. 

Process one salesperson’s figures at a time.

Enter sales in dollars (­1 to end): 5000.00
Salary is: $650.00
Enter sales in dollars (­1 to end): 6000.00
Salary is: $740.00
Enter sales in dollars (­1 to end): 7000.00
Salary is: $830.00
Enter sales in dollars (­1 to end): ­1

Solution:

#include < cstdio>
#include < cstdlib>
#include < iostream>
#include < iomanip>
using namespace std;
int main()
{
//variable declarations
double minSalary = 200;

double commission;
double sales;
double totalSalary;
//take sales amount
cout << "Enter sales in dollars (‐1 to end) : ";
cin >> sales;
while( sales ! = 1) // loop till user enter ‐1
{
commission = sales*9/100;
totalSalary = commission + minSalary;
//display total weekly salary
cout << "Salary is: $" << setprecision(2) << fixed << totalSalary << endl;
//take sales amount
cout << "/nEnter sales in dollars (‐1 to end) : ";
cin >> sales;
}
//for pause
system("PAUSE") ;
return 0;
}

zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: