/* An industrial organization wants to computerize the allowance calculations.
Given the monthly sales for the salesman, the rules for the calculations are as follows:
i. If the total sales is less than Rs. 10000/- there is no allowance.
ii. If the total sales is between Rs. 10000/- and Rs. 20000/- then the allowance is 10%
of the sales amount or Rs. 1800/- whichever is minimum.
iii. If the total sales is greater than or equal to Rs. 20000/- then the allowance is
20% of the sales amount or 6000/- whichever is minimum.
Write a program using a function to calculate the allowance.
*/
#include<iostream.h>
#include<conio.h>
void main()
{
float company(float); //Function prototype
float sales,allowance;
clrscr();
cout<<"Enter the sales: ";
cin>>sales;
allowance=company(sales); //Function call
cout<<"Allowance="<<allowance;
getch();
}
float company(float sales)
{
float allowance;
if(sales<10000)
allowance=0.0;
else if(sales>=10000&&sales<20000)
{
allowance=sales*10/100;
if(allowance>1800)
allowance=1800;
}
else if(sales>=20000)
{
allowance=sales*20/100;
if(allowance>6000)
allowance=6000;
}
return (allowance);
}

No comments: