/*Problem 7 : Write a C++ program to process the sales activity for 20 salesman. Each salesman deals in separate product and is assigned an annual target. At the end of the month, his monthly sales is added into the salestilldate. At the end of the year, his commission is calculated as follows: if sales made is more than target then the commission is 25% of the extra sales made +10 % of the target if sales made is equal to the target then the commission is 10% of the target. Otherwise commission is zero.
*/
//Solution
#include<iostream.h>
#include<conio.h>
class Sales
{
int productno;
int target;
float salestilldate;
int months; // no of months whose details have been recoredd
float commission;
char performance(void);
public :
Sales()
{
productno = 0;
target = 0;
salestilldate=0;
commission=0;
months=0;
}
// constructor
void init(void);
void addsales();
float calcomm(void);
void display(void);
~Sales() //destructor
{
}
}; // class Sales definition ends
char Sales :: performance(void)
{
char ch;
if(salestilldate>target)
ch='E';
else if(salestilldate==target)
ch='G';
else
ch='P';
return ch;
}
void Sales :: init()
{
cout<<"\nEnter product no:";
cin>>productno;
cout<<"\nEnter Annual target:";
cin>>target;
cout<<"\n";
}
void Sales :: addsales()
{
months++;
if(months>12)
cout<<"Yearly Details full..! No more sales can be entered for this year.\n";
else
{
cout<<"\nEnter sales for month"<<months<<":";
float sales;
cin>>sales;
salestilldate +=sales;
cout<<endl;
}
return;
}
void Sales :: display(void)
{
cout<<"\nProduct no :"<<productno;
cout<<"\nAnnual Target :"<<target;
cout<<"\nSales till Date :"<<salestilldate;
cout<<"\nCommission :"<<commission;
cout<<"\n";
}
float Sales :: calcomm(void)
{
if(months==0)
{
cout<<"No details have been entered till date !\n";
cout<<"So, commission cannot be calculated\n";
}
else if(months<12)
{
cout<<"Yearly details not full.\n";
cout<<"Do you still want to calculate the commission?(y/n)..";
char ans;
cin>>ans;
if(ans=='n'|| ans=='N')
goto lb1;
}
{
char ch = performance();
float comm=0.0;
if(ch=='E')
comm=(salestilldate-target)*0.25+target*0.10;
else if(ch=='G')
comm=target*0.10;
commission = comm;
cout<<"Calculated commission is :"<<comm<<endl;
return comm;
}
lb1:
}
int main()
{
clrscr();
Sales salesman[20]; // Array to store information for 20 salesman
//Get details about 20 salesman;
for(int i=0; i<20; i++)
{
cout<<"\nEnter details for salesman"<<(i+1)<<"\n";
salesman[i].init();
}
// Display menu
int ch, sno;
do
{
cout<<"\nMain Menu";
cout<<"1. Add monthly sales\n";
cout<<"2. Calculate commission\n";
cout<<"3. Display details\n";
cout<<"4. Exit\n";
cout<<"Enter your choice(1-4):";
cin>>ch;
cout<<"\n";
if(ch>0 && ch <4)
{
cout<<"\nEnter Salesman number:";
cin>>sno;
}
switch(ch)
{
case 1 : salesman[sno-1].addsales();
break;
case 2 :salesman[sno-1].calcomm();
cout<<"\n";
break;
case 3 :salesman[sno-1].display();
break;
case 4 : break;
default : cout<<"\nWrong choice!\n";
};// end of switch
lb1:
}while(ch>0 && ch<4);
return 0;
} // end of main()
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement 
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

  • Write a C + + program the activity for 20 salesman each deals in separate product and is assigned an annual target at the end of the month his monthly sales is adds in to the sale till date at the end of the year his commissions is calculated as follows if sales made is more than target then the commission is 25% of the extra sales made + 10 % of the target if sales made is equal to the target then the commission is 10% of the target otherwise commission is zero.

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1 Enter the two operands using constructer and perform arithmetic operations (+, -, *, /) on them and display the result.
2 To enter any number and find its factorial and display it using constructor
3 To demonstrate the use of parameterized constructor.
4 To demonstrate the use of default constructor for the object of class
5 Program to illustrate the copy constructor for the object of class.
6 To find largest of three members using constructors and then use destructors at the end of program
7 To find biggest of the use friend function using inline function
8 To demonstrate the use of friend function using inline function
9 To find largest of two numbers using common friend function
10 To demonstrate classes & pointers.
11 To simulate saving account processing in a bank using constructors also use destructors at the end of the program
12 To generate Fibonacci series using copy constructor
13 Write a program to find the sum of two entered complex numbers from two different classes and display the sum using a common friend to two classes.
14 Write a C + + program the activity for 20 salesman each deals in separate product and is assigned an annual target at the end of the month his monthly sales is adds in to the sale till date at the end of the year his commissions is calculated as follows if sales made is more than target then the commission is 25% of the extra sales made + 10 % of the target if sales made is equal to the target then the commission is 10% of the target otherwise commission is zero.

 

     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement