Wednesday 7 December 2016

11C Prog16. Write a algorithm and C++ program to calculate commission for the salesman. The commission is calculated according to the following rates:

16.   Write a algorithm and C++ program to calculate commission for the salesman.
The commission is calculated according to the following rates:
SALESMAN COMMISSION RATE COMMISSION
30001 onwards 15%
22001-30000 10%
12001-22000 7%
5001-12000 3%
0-5000 0 %
The program accepts the sales made by the salesman and display the
calculated commission.

Algorithm

Input
1. sm //sales amount
output
1. com  //commission
Method:
1.start
2.Read sm
3.Print sm
4. //logic for commission calculation

  if(sm > 30000)
    cm=(15*sm)/100;
  else
  if ( (sm >= 22001) && (sm <=30000) )
    cm=(10*sm)/100;
  else
  if ( (sm >= 12001) && (sm <=22000) )
    cm=(7*sm)/100;
  else
  if ( (sm >= 5001) && (sm <=12000) )
    cm=(3*sm)/100;
  else
    cm=0;
 
 5. Print cm
 6. stop