Question

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 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.

SampleOutput
Enter paycode (-1 to end): 3
Commission worker selected.
Enter gross weekly sales: 4000
Commission worker’s pay is $ 478.00
Enter paycode (-1 to end): 2
Hourly worker is selected.
Enter hourly salary: 4.5
Enter the total hours worked: 20
Worker’s pay is $90.00
Enter paycode (-1 to end): -1
Summary of Payouts
Employee Categories Number Paid
—————————— —————–
Managers 0
Hourly Workers 1
Commission Workers 0
Piece Workers 0

Note: the program must include appropriate code comments, run properly, and be easy to understand.

0 2
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;

int main() {

int paycode,mgrCount,hworkersCount,cworkersCount,pworkersCount;

mgrCount=hworkersCount=cworkersCount=pworkersCount=0; // initialize counters

double hourlySalary,moneyPerItem;
int hoursWorked,grossWeeklySales,items;

do // loop
{
cout<<"\nEnter paycode (-1 to end): ";
cin>>paycode;
if(paycode == -1)
break;

switch(paycode)
{
  case 1:
  cout<<"\nManager selected.";
  mgrCount++;
  break;
  
  case 2:
  cout<<"\nHourly worker is selected.";
  cout<<"\nEnter hourly salary: ";
  cin>>hourlySalary;
  cout<<"\nEnter the total hours worked: ";
  cin>>hoursWorked;
  cout<<"\nWorker’s pay is $"<<hourlySalary*hoursWorked;
  hworkersCount++;
  break;
  
  case 3:
  cout<<"\nCommission worker selected.";
  cout<<"\nEnter gross weekly sales: ";
  cin>>grossWeeklySales;
  cout<<"\nCommission worker’s pay is $ "<<250+grossWeeklySales*0.057;
  cworkersCount++;
  break;
   
  case 4:
  cout<<"\nPiece worker is selected.";
  cout<<"\nEnter money per item :";
  cin>>moneyPerItem;
  cout<<"\nEnter the number of items : ";
  cin>>items;
  cout<<"\nPiece worker’s pay is $ "<<moneyPerItem*items;
  pworkersCount++;
  break;
  
  default:
  cout<<"\nInvalid paycode.";
  break;
  
  
}
}while(paycode != -1);
cout<<"\nSummary of Payouts";
cout<<"\nEmployee Categories Number Paid";
cout<<"\n—————————— —————–";
cout<<"\nManagers "<<mgrCount;
cout<<"\nHourly Workers "<<hworkersCount;
cout<<"\nCommission Workers "<<cworkersCount;
cout<<"\nPiece Workers "<<pworkersCount;


return 0;
}

Output:

Enter paycode (-1 to end):3
Commission worker selected.
Enter gross weekly sales:4000
Commission worker’s pay is $ 478

Enter paycode (-1 to end):2
Hourly worker is selected.
Enter hourly salary:4.5
Enter the total hours worked:20
Worker’s pay is $90

Enter paycode (-1 to end):-1
Summary of Payouts
Employee Categories Number Paid
—————————— —————–
Managers 0
Hourly Workers 1
Commission Workers 1
Piece Workers 0

Dp ask if any doubt. Please upvote.

Add a comment
Know the answer?
Add Answer to:
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Programming Assignment Objectives: The objectives of Week 1 assignment is: Implement multiple selection using the...

    C++ Programming Assignment Objectives: The objectives of Week 1 assignment is: Implement multiple selection using the control statements ( i. e switch selection statement) Work with functions in C++ and to use the logical operators Assignment Purpose: To write a program that demonstrates the concepts of the control statements that we learned this week. Assignment Description: Problem Description: A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for...

  • Acme Parts runs a small factory and employs workers who are paid one of three hourly...

    Acme Parts runs a small factory and employs workers who are paid one of three hourly rates depending on their shift: first shift, $17 per hour; second shift, $18.50 per hour; third shift, $22 per hour. Each factory worker might work any number of hours per week; any hours greater than 40 are paid at one and one-half times the usual rate. In addition, second- and third-shift workers can elect to participate in the retirement plan for which 3% of...

  • Develop a WPF application that has a button to calculate an employee’s weekly pay, given the...

    Develop a WPF application that has a button to calculate an employee’s weekly pay, given the number of hours worked. An employee should have a first name, last name, age, and hourly consulting rate. You should be able to create an employee object and provide the hours worked to calculate the weekly pay. The application assumes a standard workweek of 40 hours. Any hours worked over 40 hours in a week are considered overtime and earn time and a half....

  • If the employee is a supervisor calculate her paycheck as her yearly salary / 52 (weekly...

    If the employee is a supervisor calculate her paycheck as her yearly salary / 52 (weekly pay) If the employee is not a supervisor and she worked 40 hours or less calculate her paycheck as her hourly wage * hours worked (regular pay) If the employee is not a supervisor and worked more than 40 hours calculate her paycheck as her (hourly wage * 40 ) + (1 ½ times here hourly wage * her hours worked over 40) (overtime...

  • Write a C++ console application that uses functions to calculate an employee’s salary.

    Write a C++ console application that uses functions to calculate an employee’s salary.PART 1: Create a void function to print a menu asking the user to choose from the following options:1 - Annual salary2 - Monthly salary3 - Daily rate of pay4 – ExitThe void function only prints the menu. Format your cout statement to include the menu as displayed above.If the chosen option is 1- Annual Salary, ask the user for the number of hours they work perweek and...

  • in C++ Write a program which uses the following arrays: empID: An array of 7 integers...

    in C++ Write a program which uses the following arrays: empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7. Hours: an array of seven integers to hold the number of hours worked by each employee. payRate: an array of seven doubles to hold each employee’s hourly pay rate. Wages: an array of seven doubles to hold each employee’s gross salary. The program...

  • RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a Company to implement a prot...

    RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a Company to implement a prototype for its payroll system. You receive the following specifications: If an employee works more than its regular hours, it is considered overtime and it will be paid based on the employee’s experience. All employees are paid biweekly (80 hours) Employee taxes: 1% This company manages three categories of workers based on employee’s experience. Group 1 (Silver) o Pay rate:...

  • The Payroll Department keeps a list of employee information for each pay period in a text...

    The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: <last name> <hourly wage> <hours worked> Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular format with the appropriate header. Each line should contain: An employee’s name...

  • Assignment Four (T) Compatiblity Mode 4 Weekly Payroll. Wnite a Java program to create a weekly p...

    Assignment Four (T) Compatiblity Mode 4 Weekly Payroll. Wnite a Java program to create a weekly payroll using the following Adrated Weekly Income Income Tax Withheld $0 to $124 Over $124 to $399 Over $899 to $1,85 Over $1,855 to 53,064 Over $3,084 to $3,439 Over $5,439 Tax Guide. Your program should request the following information employee id number (integer), hourly wage, hours worked per week, number of with holding exemptions, manital status (use a code 0 and 1 or...

  • Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate...

    Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate the weekly paycheck for both Salaried and Hourly employees. Salaried employees will be paid 1/52 of their annual pay minus 18% withheld for federal and state taxes, as well as 4% for retirement pension. Salaried employees do not collect overtime pay. There are two types of Hourly employees; permanent employees and temporary weekly employees. •Permanent weekly employees will be paid their hourly rate minus...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT