sales commission

Write your question here.

Use a selection structure inside a function to solve the problem.

Assume a salesperson is paid a variable-rate commission depending on the number of sales made for the week. The quota is 30 sales.

If the persons individually make fewer than 10 sales, they are paid $50/sale. If they make 10 to 30 sales, they are paid $100/sale. If they exceed the quota, they are paid $150/sale. If they make fewer than 5 sales or more than 60 sales, it is considered to be an input error and no commission is paid.

Write a program to input a salesperson's name and number of sales made. Write a function that will calculate the commission. The function should accept number of sales and return amount of commission.

Output the name and commission from main. Be sure to test all significant cases.
1
2
3
  Put the code you need help with here.

please i need help making this program i don't know how to make it  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <cstdlib>
#include <iomanip>

double com_earned(size_t);

using namespace std;

int main()

{
	string name;
	size_t sales;

	cout << "Enter employees name: ";
	getline(cin, name);
	cout << endl << endl
	     << "Enter # of  sales made by " << name << ": ";
	cin >> sales;
	cout << endl << endl << "$" 
	     << fixed << setprecision(2) << com_earned(sales) << endl;		
	
	return EXIT_SUCCESS;
}
	
double com_earned(size_t x)
{
	if(x >= 5 && x<10)
		return x*50;
	else if(x >= 10 && x <= 30)
		return x*100;
	else if(x > 30 && x <= 60)
		return x*150;
	else
	   	return 0;
}

Topic archived. No new replies allowed.