Write a program that displays the following menu to the user:
Press 1 for Permanent Employee
Press 2 for Daily wages Employee
After selecting the appropriate employee calculate salary and medical charges for the employees. Following menu would be displayed:
Press a to calculate Salary
Press b to calculate medical charges.
The daily wages employees are paid 400 per hour while permanent employees are paid 800 per hour.When you would calculate the salary, first you need to ask for the number of hours for which the employee has worked so far. The permanent employees are paid 5% medical charges of their total salary while daily wages are paid 3% of medical charges. For calculating medical allowance no further selection/input is required.
#include <iostream>
using namespace std;
int main()
{
int s;
char f;
float sal,hr,al;
cout << "\t\t***************************************" << endl;
cout << "\t\t\tPress 1 for Permanent Employee" << endl;
cout << "\t\t\tPress 2 for Daily wages Employee" << endl;
cout<<"Press: "<<endl;
cin>>s;
switch(s)
{
case 1:
cout<<"***********Permanent Employees*******"<<endl;
cout<<"Press a to calculate Salary"<<endl;
cout<<"Press b to calculate medical charges"<<endl;
cout<<"Press: "<<endl;
cin>>f;
switch(f)
{
case 'a':
cout<<"Enter number of hours: "<<endl;
cin>>hr;
sal=800*hr;
cout<<"The employee salary: "<<sal<<endl;
break;
case 'b':
al=100000*0.05;
cout<<"Medical allowances: "<<al<<endl;
break;
}
break;
case 2:
cout<<"*********** Daily wages Employee*******"<<endl;
cout<<"Press a to calculate Salary"<<endl;
cout<<"Press b to calculate medical charges"<<endl;
cout<<"Press: "<<endl;
cin>>f;
switch(f)
{
case 'a':
cout<<"Enter number of hours: "<<endl;
cin>>hr;
sal=400*hr;
cout<<"The employee salary: "<<sal<<endl;
break;
case 'b':
al=50000*0.03;
cout<<"Medical allowances: "<<al<<endl;
break;
}
break;
}
return 0;
}
Comments
Leave a comment