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

*** PLEASE USE C++ *** Topics if/else if Description Write a program that calcul

ID: 3804198 • Letter: #

Question

*** PLEASE USE C++ ***

Topics

if/else if

Description

Write a program that calculates a sales person’s monthly commission. The program asks the user to input the total sales amount for the month. It calculates the commission and displays a report including the sales amount and the commission earned. The commission is computed using the following:

15% commission for the first $2,000.00 sales

20% commission for the next $1,000.00 sales

25% commission for the next    $500.00 sales

30% commission for the next    $500.00 sales

35% commission for the remaining sales

Implementation

The code below shows only a part of the if /else if statement that calculates the commission amount from the sales amount. The if else if statement below needs to be completed by adding additional if else components. In the statement below, the variable sales contains the sales amount and the variable commission the commission amount. Both the sales and commission are variables of type double.

if ( sales <= 2000.00)

{

            commission = .15 * sales;

}

else if (sales <= 3000.00)

{

            commission = (.15 * 2000.00) + ( (sales – 2000.00) * .20 );

}

else if (sales <= 3500.00)

{

          commission = (.15 * 2000.00) + ( .20 * 1000.00) + ( (sales – 3000.00) * .25 ) ;

}

Test Data

Use the following for the test data:

Input Test Run 1

Enter Sales Amount: 1500.00

Output Test Run 1

Sales Amount:              1500.00

Commission Earned:     225.00

Input Test Run 2

Enter Sales Amount: 2500.00

Output Test Run 2

Sales Amount:              2500.00

Commission Earned:       400.00

Input Test Run 3

Enter Sales Amount: 3500.00

OutPut Test Run 3

Sales Amount:              3500.00

Commission Earned:     625.00

Input Test Run 4

Enter Sales Amount: 4000.00

Output Test Run 4

Sales Amount:              4000.00

Commission Earned:       775.00

Input Test Run 4

Enter Sales Amount: 4500.00

Output Test Run 4

Sales Amount:              4500.00

Commission Earned:       950.00

Explanation / Answer

Given

15% commission for the first $2,000.00 sales first 2000 .15*2000

20% commission for the next $1,000.00 sales--for next means we need to sub frs 2000 and then 20% of remaing amout (Total amount will be <=2000+1000)

25% commission for the next    $500.00 sales--here this is for amount (2000+1000+500)for 500 25%

30% commission for the next    $500.00 sales--here this is for total amount of (2000+1000+500+500)till 3500 the above calcs and next 500 mean (sales-amount above cal til now i.e ((2000+1000+500))

35% commission for the remaining sales this is for all sales value which is higher than (2000+1000+500+500) i.e for above 4000.

#include <iostream>
using namespace std;
int main()
{
double sales,commission=0.0;
cout << "Enter Sales Amount " ;
cin>>sales;
if (sales<=2000.00)
{
commission =.15 * sales;
}
else if (sales<=3000.00)
{
commission =.15*2000.00 +(sales-2000.00)*.20 ;
}
else if (sales<=3500.00)
{
commission =.15 *2000.00 +.20*1000.00 +(sales-3000.00)*.25;
}
else if(sales<=4000.00)
{
commission =.15 *2000.00 +.20*1000.00 +.25*500.00+(sales-3500.00)*.30;
}
else
{
commission =.15 *2000.00 +.20*1000.00 +.25*500.00+.30*500+(sales-4000.00)*.35;
}
cout<<"Commission Earned : "<<commission<<endl;
return 0;
}