Write a C++ program that will input an employee's monthly sales and calculate the gross pay, deductions, and net pay. Each employee will receive a base pay of $1000 plus a sales commission. The amount of sales commission will depend on the monthly sales of the employee as given in Table 1 below:
Table 1 Commission Rates Monthly Sales Commission Greater than or equal to $50,000 16% of sales Less than $50,000 but greater than or equal to $40,000 12% of sales Less than $40,000 but greater than or equal to $30,000 10% of sales Less than $30,000 but greater than or equal to $10,000 6% of sales Less than $10,000 3% of sales Table 2 below gives a short description of all the elements important to the calculation of the pay of the employee. Table 2 Base pay $1000; use a named constant Commission Dependent on monthly sales – refer to Table 1 Gross pay Sum of base pay and commission Deductions 18% of gross pay Net pay Gross pay minus deductions
#include <iostream>
using namespace std;
int main(){
const int BasePay = 1000;
int sales;
float commission, grossPay, deductions, netPay;
cout<<"Input monthly sales: ";
cin>>sales;
if(sales >= 50000)
commission = 0.16 * sales;
else if(sales >= 40000)
commission = 0.12 * sales;
else if(sales >= 30000)
commission = 0.1 * sales;
else if(sales >= 10000)
commission = 0.06 * sales;
else commission = 0.03 * sales;
grossPay = BasePay + commission;
deductions = 0.18 * grossPay;
netPay = grossPay - deductions;
cout<<"Gross Pay:\t"<<grossPay<<endl;
cout<<"Deductions:\t"<<deductions<<endl;
cout<<"Net Pay:\t"<<netPay<<endl;
return 0;
}
Comments
Leave a comment