Question

In: Computer Science

A company pays its employees as managers (who receive a fixed weekly salary)

A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half,” i.e. 1.5 times their hourly wage, for overtime hours worked), commission workers (who receive $250 plus 5.7% 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 pay 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 based on that employee’s paycode. Within the switch, prompt the user to enter the appropriate facts your program needs to calculate each employee’s pay based on that employee’s paycode.

Solutions

Expert Solution

/*Copyable Code*/

#include
#include
#include

using namespace std;

void manager_pay_code();
void hourly_workers_pay_code();
void commision_workers_pay_code();
void piece_workers_pay_code();

/* Main Function that accepts input from user regarding paycode and executes corresponding function */
int main()
{
int paycode;
int managers=0, hourly_workers=0, piece_workers=0, commision_workers=0;


cout<< endl << endl << "Enter Paycode (-1 to end): " ;
cin>>paycode;

while(paycode != -1)
{
switch(paycode)
{
case 1: manager_pay_code(); //Calls Manager Paycode Function
managers++;
break;

case 2: hourly_workers_pay_code(); //Calls Hourly Workers Function
hourly_workers++;
break;

case 3: commision_workers_pay_code(); //Calls Commission Workers Function
commision_workers++;
break;

case 4: piece_workers_pay_code(); //Calls Piece Workers Function
piece_workers++;
break;

default: cout<<"Invalid Choice";
break;
}

cout<< endl << endl << "Enter Paycode (-1 to end): " ;
cin>>paycode;
}
  
//Printing Payout Statistics
cout< cout< cout< cout< cout< cout< cout<

getch();
return 0;
}

//Manager Function
//Input: None
//OutPut: None
//Operation: Accept salary and prints the same as final salary
void manager_pay_code()
{
float final_pay;
  
cout<< endl <<"Manager selected.";
  
cout< cin>>final_pay;
  
cout<< endl <<"Manager pay is $" << final_pay;
}

//Hourly Workers Function
//Input: None
//OutPut: None
//Operation: Accepts hourly salary and hours worked and calculate final salary and print final salary
void hourly_workers_pay_code()
{
float hourly_salary;
int hours_worked, actual_hours, ot_hours;
float final_pay;
  
cout<< endl <<"Hourly worker is selected.";
  
cout< cin>>hourly_salary;
  
cout< cin>>hours_worked;
  
//Code that divides actual hours and overtime(ot) hours
if(hours_worked > 40)
{
actual_hours = 40;
ot_hours = hours_worked - 40;
}
else
{
actual_hours = hours_worked;
ot_hours = 0;
}
  
final_pay = (actual_hours * hourly_salary) + (1.5 * (ot_hours * hourly_salary));
  
cout<< endl <<"Hourly worker pay is $" << final_pay;
}

//Manager Function
//Input: None
//OutPut: None
//Operation: Accept gross weekly sales and calculates the final salary an prints final salary
void commision_workers_pay_code()
{
int gross_weekly_sales;
float final_pay;
  
cout<< endl <<"Commission worker selected.";
  
cout< cin>>gross_weekly_sales;
  
final_pay = 250 + ((5.7*gross_weekly_sales)/100);
  
cout<< endl <<"Commission worker's pay is $" << final_pay;
}
//Manager Function
//Input: None
//OutPut: None
//Operation: Accept price per item and number of items and calculate final pay and prints final pay
void piece_workers_pay_code()
{
int no_of_items;
float final_pay, price_per_item;
  
cout<< endl <<"Piece worker selected.";
  
cout< cin>>no_of_items;
  
cout< cin>>price_per_item;
  
final_pay = no_of_items * price_per_item;
cout<< endl <<"Piece worker pay is $" << final_pay;
}


Related Solutions

A company pays its employees as managers (who receive a fixed weekly salary)
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half”—i.e., 1.5 times their hourly wage—for overtime hours worked), commission workers (who receive $250 plus 5.7% of their gross weekly sales), or pieceworkers (who receive a fixed amount of money for each of the items they produce—each pieceworker in this company works on only one type of item). Write...
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who...
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half”—i.e., 1.5 times their hourly wage—for overtime hours worked), commission workers (who receive $250 plus 5.7% of their gross weekly sales), or pieceworkers (who receive a fixed amount of money for each of the items they produce—each pieceworker in this company works on only one type of item). Write...
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who...
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half,” i.e. 1.5 times their hourly wage, for overtime hours worked), commission workers (who receive $250 plus 5.7% 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...
Problem Description A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work
Programming Language: C++Problem Description A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half,” i.e. 1.5 times their hourly wage, for overtime hours worked), commission workers (who receive $250 plus 5.7% 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...
A company pays its employees as managers (who receive a fixedweekly salary), hourly workers (who...
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half,” i.e. 1.5 times their hourly wage, for overtime hours worked), commission workers (who receive $250 plus 5.7% 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...
A company pays its employees as managers (who receive a fixed 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 )
USING C++A company pays its employees as managers (who receive a fixed 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). Write a program...
Many universities pay their teaching assistants (TA) or associate instructors (AI) as weekly workers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 10 hours they work and “time-and-a-half”
Needs to be written in CMany universities pay their teaching assistants (TA) or associate instructors (AI) as weekly workers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 10 hours they work and “time-and-a-half”- i.e., 1.5 times their hourly wage - for overtime hours worked), commission workers (who receive $250 plus 7.1 times their gross weekly work hours), or pieceworkers (who receive a fixed amount of money for each of...
Grouper Company pays its office employee payroll weekly. Below is a partial list of employees and...
Grouper Company pays its office employee payroll weekly. Below is a partial list of employees and their payroll data for August. Because August is their vacation period, vacation pay is also listed. Employee --Earnings to July 31----    Weekly Pay-----    Vacation Pay to Be Received in August Mark Hamill $5,010    $200    --- Karen Robbins $4,310 $150    $300 Brent Kirk    $3,510 $110 $220 Alec Guinness    $8,210 $250 --- Ken Sprouse    $8,810 $330    $660...
Pina Company pays its office employee payroll weekly. Below is a partial list of employees and...
Pina Company pays its office employee payroll weekly. Below is a partial list of employees and their payroll data for August. Because August is their vacation period, vacation pay is also listed. Employee Earnings to July 31 Weekly Pay Vacation Pay to Be Received in August Mark Hamill $5,200 $240 - Karen Robbins 4,500 190 $380 Brent Kirk 3,700 150 300 Alec Guinness 8,400 290 - Ken Sprouse 9,000 370 740 Assume that the federal income tax withheld is 10%...
Marigold Company pays its office employee payroll weekly. Below is a partial list of employees and...
Marigold Company pays its office employee payroll weekly. Below is a partial list of employees and their payroll data for August. Because August is their vacation period, vacation pay is also listed. Employee Earnings to July 31 Weekly Pay Vacation Pay to Be Received in August Mark Hamill $5,200 $240 - Karen Robbins 4,500 190 $380 Brent Kirk 3,700 150 300 Alec Guinness 8,400 290 - Ken Sprouse 9,000 370 740 Assume that the federal income tax withheld is 10%...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT