Write a C++ class Seller (S_Name, Product_name, Sales_Quantity, Target_Quantity, Month, Commission). Each salesman deals with a separate product and is assigned a target for a month. At the end of the month his monthl y sales is compared with target and commission is calculated as follows:
•If Sales_Quantity>Target_Quantity then commission is 25% of extra sales made + I0% of target.
•If Sales_Quantit y = Target_Quantity then commission is 10% of target.
•Otherwise commission is zero.
Display salesman information along with commission obtained. (Use array of object)
#include<iostream.h>
#include<conio.h>
class
sales
{
char
sname[20],pname[20];
int
squantity,target,month;
float
commission;
public:
void
get()
{
cout<<"Enter
salesman name:\t";
cin>>sname;
cout<<"\nEnter
product name:\t";
cin>>pname;
cout<<"\nEnter
sales quantity:\t";
cin>>squantity;
cout<<"\nEnter
target:\t";
cin>>target;
cout<<"\nEnter
month:\t";
cin>>month;
void
put()
{
cout<<"\nSalesman
name:\t"<<sname;
cout<<"\nProduct
name:\t"<<pname;
cout<<"\nSales
quantity:\t"<<squantity;
cout<<"\nTarget:\t"<<target;
cout<<"\nMonth:\t"<<month;
commission=0;
if(squantity>target)
{
commission=commission+((squantity-target)*0.25)+(target*0.10);
}
else
if(target=squantity)
{
commission=commission+(target*0.10);
}
else
{
commission=0;
}
cout<<"\nCommission:\t"<<commission;
}
};
void
main()
{
sales
sman[10];
int
i,n;
clrscr();
cout<<"\n
Enter how many Salesman : ";
cin>>n;
for(i=0;i<n;i++)
{
sman[i].get();
}
for(i=0;i<n;i++)
{
sman[i].put();
}
getch();