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

Hello all, this is for C++.Thank you for your time! Use C++ to create a program

ID: 3741618 • Letter: H

Question

Hello all, this is for C++.Thank you for your time!

Use C++ to create a program that will allow the user to enter 4 monthly sales values and find the average sales. Then it should calculate the salesperson's commission according to the following table.

Average Sales Commission Rate

0 <= average sales <= 5000 5%

5000 < average sales <= 10000 7%

10000 < average sales <= 15000 11%

Output should be the 4 sales values, the average sales, the commission rate, and the amount of commission. Format all the money with a $ and 2 decimal places. Test the program with the following data: Salesperson 1: 3000, 2000, 4000, 1500 Salesperson 2: 8000, 5000, 9500, 8500 Salesperson 3: 12500, 11000, 12000, 14000 Salesperson 4: 15000, 20500, 18000, 16500.

I need the code and the output for this as well.

Explanation / Answer

#include <iostream>

using namespace std;

int main()
{
int sales[4][4];
for(int i=0;i<4;i++) {
cout<<"Salesperson "<<i+1<<": "<<endl;
for(int j=0;j<4;j++){
cin >> sales[i][j];
}
}
int total;
int percentage;
for(int i=0;i<4;i++) {
total = 0;
cout<<"Sales: ";
for(int j=0;j<4;j++){
cout<<sales[i][j]<<" ";
total+=sales[i][j];
}
cout<<endl;
double avg = total/4.0;
cout<<"Average: "<<avg<<endl;
if(avg>10000) {
percentage=11;

} else if(avg>5000 && avg<=10000){
percentage= 7;
} else {
percentage=5;
}
cout<<"commission rate: "<<percentage<<endl;
cout<<"The amount of commission: "<<(total*percentage)/100.0<<endl;
}

return 0;
}

Output:

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