One large chemical company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who sells $5000 worth of chemicals in a week receives $200 plus 9 percent of $5000, or a total of $650. Develop a C++ program inputs each salesperson's gross sales for last week and calculates and displays that salesperson's earnings. Process one salesperson's figures at a time
#include <iostream>
using namespace std;
int main()
{
int total_employee = 0;
double total_sales = 0.0, total_salary = 0.0;
cout << "Total number of available employees: " << flush;
cin >> total_employee;
if (total_employee == 0) {
cout << "There is no emploees" << endl;
return 0;
}
else if (total_employee < 0) {
cout << "Total number of emploee can not be negative!" << endl;
return 0;
}
int i = 0;
while(i < total_employee) {
cout<<"Please enter the sales amount(> $0.00): " ;
cin>>total_sales;
if (total_sales <= 0)
{
cout<<"You are in loss, you need to work on it make it profitable"<<endl;
return 0;
}
else
{
total_salary = (total_sales * 0.09) + 200;
cout<<"This week's total salary $"<<total_salary<<endl;
}
++i;
}
return 0;
}
Comments
Leave a comment