#Include #Include
#Include #Include
weekly salary), hourly workers (who receive a fixed hourly wage for up to the
first 40 hours they work and "time-and-a-half"1.5 times their hourly wage for
overtime hours worked), commission workers (who receive $250 plus 5.7
percent of their gross weekly sales), or pieceworkers (who receive a fixed
amount of money per item for each of the items they produce each
pieceworker in this company works on only one type of item). Write a
program to compute the weekly pay for each employee. You do not know the
number of employees in advance. Each type of employee has its own pay
code: Managers have code 1, hourly workers have code 2, commission
workers have code 3 and pieceworkers have code 4. Use a switch to compute
each employee's pay according to that employee's pay_code. Within the
switch, prompt the user (i.e., the payroll clerk) to enter the appropriate facts
your program needs to calculate each employee's pay according to that
employee's pay_code.
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
char employee;
int manager, hourlyworker, pieceworker, commissionworker;
int income, pay1, hours, item, money, sale, income1, pay2, income2, income3;
cout << "Enter 1 for manager,2for hourlyworker,3for comissionworker,4 for
pieceworker" << endl;
cin >> employee;
switch (employee)
{
case '1':
{
cout << "enter weekly income of manager?" << endl;
cin >> income;
cout << "income of manager is: " << income << endl;
break;
}
case '2':
{
cout << "enter per hour income of hourly employee" << endl;
cin >> pay1;
cout << "enter number of hours worker worked!!" << endl;
cin >> hours;
if (hours <= 40)
{
income1 = pay1 * 40;
}
else {
income1 = (pay1 * 40) + (pay1*(hours - 40)*1.5);
}
cout << "Total income of hourly worker" << income1 << endl;
break;
}
case '3':
{
cout << "enter the gross weekly sale?" << endl;
cin >> sale;
income2 = 250 + (0.57*sale);
cout << "total income of comission employee is" << income2 << endl;
break;
}
case '4':
{
cout << "enter amount of money per item?" << endl;
cin >> money;
cout << "enter the number of item employee produce?" << endl;
cin >> item;
income3 = money * item;
cout << "income of the pieceworker is" << income3 << endl;
break;
}
}
_getch();
return 0;
}