Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a new project and name it: HW 1a Create a new file and name it: main.cpp

ID: 3648406 • Letter: C

Question

Create a new project and name it: HW 1a Create a new file and name it: main.cpp Include these 3 functions getSalftsAmt The function prompts the user to enter a monthly Gales amount. (see output) The amount is read and assigned to a variable The value is then returned to main() calcCommission This function calculates the commission based on the sales amount. If a salesperson sells more than $50,000. per month, the commission is 2% of the sales amount. If the sales are between $25,000. and $50,000., then the commission is 1.5% of the sales amount. However, if the sales are less than $25,000., there is no commission The value is returned to main(). displayPay This function calculates the total monthly pay for a salesperson. A salesperson gets a monthly salary of $2,500. plus a commission, if the person as earned a commission. The value is returned to main(). displayPay This function displays the total monthly pay for salesperson (see output) Format the output to two decimal places, and with the amounts aligned as shown. Include code to allow the user to run the program again.

Explanation / Answer

please rate - thanks

#include <iostream>
#include <iomanip>
using namespace std;
double getSalesAmt();
double calcCommission(double);
double calcPay(double,double);
void displayPay(double,double,double,double);
int main()
{double sales, comm, pay,base=2500;
char again;
do
{
sales=getSalesAmt();
comm=calcCommission(sales);
pay=calcPay(comm,base);
displayPay(sales,comm,base,pay);
cout<<"Do it again?(Y/N) ";
cin>>again;
}while(toupper(again)=='Y');
return 0;
}

double getSalesAmt()
{double sales;
cout<<"Enter the monthly sales amount: ";
cin>>sales;
return sales;
       }
double calcCommission(double sales)
{double rate, comm;
if(sales>50000)
      rate=2;
else if(sales>=25000)
      rate=1.5;
else
      rate=0;
comm=sales*(rate/100.);
return comm;
       }
double calcPay(double comm,double base)
{return base+comm;
       }
void displayPay(double sales,double comm,double base,double pay)
{cout<<"Monthly Sales:    $"<<setw(9)<<setprecision(2)<<fixed<<sales<<endl;
cout<<"Commission:       $"<<setw(9)<<setprecision(2)<<fixed<<comm<<endl;
cout<<"Base Pay          $"<<setw(9)<<setprecision(2)<<fixed<<base<<endl;
cout<<"Total Pay         $"<<setw(9)<<setprecision(2)<<fixed<<pay<<endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote