Answer to Question #330876 in C++ for Christine

Question #330876

Jennifer Yardley is the owner of Golf Pro, a U.S. company that sells golf equipment both domestically and abroad.


She wants a program that displays the amount of a salesperson’s commission. A commission is a percentage of


the sales made by the salesperson. Some companies use a fixed rate to calculate the commission, while others (like


Golf Pro) use a rate that varies with the amount of sales.


Golf Pro’s commission schedule is shown below, along with examples of using the schedule to calculate the


commission on three different sales amounts. Notice that the commission for each range in the schedule is


calculated differently.


Sales range


Commission


0 - 100,000 2%


100,001 – 400,000 5% over 100,000 and then add 2000


400,001 and over 10% over 400,000 and then add 17000


If the sales is less than zero, the program should display the message “The sales cannot be less than 0.”

1
Expert's answer
2022-04-19T10:01:27-0400
#include <iostream>

using namespace std;

int main()
{
	double amOfsales;
	double comission;
	cout << "Please, enter an amount of sales: ";
	cin>> amOfsales;
	if (amOfsales < 0)
		cout << "The sales cannot be less than 0.";
	else
	{
		if (amOfsales > 0 && amOfsales <= 100000)
		{
			comission = amOfsales*0.02;
			cout << "Salesperson’s commission is " << comission;
		}
		else if (amOfsales >= 100001 && amOfsales <= 400000)
		{
			comission = amOfsales*0.05+2000;
			cout << "Salesperson’s commission is " << comission;
		}
		else if (amOfsales >= 400001)
		{
			comission = amOfsales*0.1 + 17000;
			cout << "Salesperson’s commission is " << comission;
		}
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS