Question

In: Computer Science

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

I was wondering how I could get the sample output to be like this as seen below:

The sample output should be like this:


Summary of Payouts

Employee Categories      Number               Paid

-------------------------------------------------------------------------

Managers                           0                            0

Hourly Workers                1                            $ 478.00

Commission Workers 1                            $ 90.00

Piece Workers                   0                            0

I have this so far:

#include

using namespace std;

int main()
{
int paycode =0;
double weeklySalary;
double hourlySalary;
int hours;
double grossSales;
double payPerItems;
int items;
double totalPay;
int managerCount=0;
int hourlyworkerCount=0;
int commissionCount=0;
int pieceworkerCount=0;
  
cout << "Enter paycode for next employee (-1 for exit): ";
cin >> paycode;
  
while (paycode != -1)
{
switch (paycode)
{
case 1:
managerCount++;
cout << "Enter weekly salary for this manager: ";
cin >> weeklySalary;
totalPay = weeklySalary;
break;
case 2:
hourlyworkerCount++;
cout << "Enter hourly salary for this hourly worker: ";
cin >> hourlySalary;
cout << "Enter number of hours worked: ";
cin >> hours;
if (hours <= 40)
totalPay = hours * hourlySalary;
else
totalPay = 40 * hourlySalary + (hours - 40) * hourlySalary * 1.5;
break;
case 3:
commissionCount++;
cout << "Enter gross sales for this comission worker: ";
cin >> grossSales;
totalPay = 250 + grossSales * 0.057;
break;
case 4:
pieceworkerCount++;
cout << "Enter number of produced items for this pieceworker: ";
cin >> items;
cout << "Enter pay for each item: ";
cin >> payPerItems;
totalPay = items * payPerItems;
break;
default:
cout << "Wrong input! Please try again." << endl;
totalPay = 0;
break;
}
cout << "Total weekly pay is: " << totalPay << endl << endl;
cout << "Enter paycode for next employee (-1 for exit): ";
cin >> paycode;
}
cout << "Summary of payouts" << endl;
cout << "Employee Categories Number Paid" << endl;
cout << "# of Managers paid: " << managerCount << endl;
cout << "# of Hourly Workers : "<< hourlyworkerCount << endl;
cout << "# of Commissions Employees : "<< commissionCount << endl;
cout << "# of PieceWorkers : "<< pieceworkerCount << endl;
  
return 0;
}

Solutions

Expert Solution

Code:

#include
#include
using namespace std;

int main()
{

int paycode =0;

int managerCount=0;
double weeklySalary;
double totalPay_mngr = 0;

int hourlyworkerCount=0;
double totalPay_hr_Workers = 0;
double hourlySalary;
int hours;

int commissionCount=0;
double totalPay_commision_Workers = 0;
double grossSales;

int pieceworkerCount=0;
double totalPay_piece_worker = 0;
double payPerItems;
int items;
  
cout << "Enter paycode for next employee (-1 for exit): ";
cin >> paycode;
  
while (paycode != -1)
{
switch (paycode)
{
case 1:
managerCount++;
cout << "Enter weekly salary for this manager: ";
cin >> weeklySalary;
totalPay_mngr += weeklySalary;
break;
  
case 2:
hourlyworkerCount++;
cout << "Enter hourly salary for this hourly worker: ";
cin >> hourlySalary;
cout << "Enter number of hours worked: ";
cin >> hours;
if (hours <= 40)
totalPay_hr_Workers += hours * hourlySalary;
else
totalPay_hr_Workers += 40 * hourlySalary + (hours - 40) * hourlySalary * 1.5;
break;
  
case 3:
commissionCount++;
cout << "Enter gross sales for this comission worker: ";
cin >> grossSales;
totalPay_commision_Workers += 250 + grossSales * 0.057;
break;
  
case 4:
pieceworkerCount++;
cout << "Enter number of produced items for this pieceworker: ";
cin >> items;
cout << "Enter pay for each item: ";
cin >> payPerItems;
totalPay_piece_worker += items * payPerItems;
break;
  
default:
cout << "Wrong input! Please try again." << endl;
}

cout << "Enter paycode for next employee (-1 for exit): ";
cin >> paycode;
}

cout << "\n" << endl;
cout << "Summary of payouts" << endl;
cout << setw(24) << left << "Employee Categories\tNumber\tpaid" << endl;
cout << setw(24) << left << "Managers:" << managerCount << "\t$" << totalPay_mngr < cout << setw(24) << left << "Hourly Workers:"<< hourlyworkerCount << "\t$" << totalPay_hr_Workers << endl;
cout << setw(24) << left << "Commissions Workers:"<< commissionCount << "\t$" << totalPay_commision_Workers << endl;
cout << setw(24) << left << "PieceWorkers:"<< pieceworkerCount << "\t$" << totalPay_piece_worker << endl;
  
return 0;
}

-------------------------------------

Output:


Related Solutions

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 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...
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 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...
A company is trying to decide to pay employees a fixed salary or an hourly wage....
A company is trying to decide to pay employees a fixed salary or an hourly wage. If the company decides to pay salaries, which statement is true? (2pts) Paying salaries would have no affect on fixed costs or the contribution margin. Salaries decrease the total fixed costs and the contribution margin would be lower. Salaries increase total fixed costs and the contribution margin would be higher. 2) A company is trying to decide to pay employees a fixed salary or...
Telemarketers Inc. hires over 2,200 hourly workers. The company wants to compute the average wage it pays these workers.
Telemarketers Inc. hires over 2,200 hourly workers. The company wants to compute the average wage it pays these workers. What is the minimum sample size needed to construct a 90% confidence interval for the average wage Telemarketer Inc. pays its hourly workers? Assume the standard deviation is $10.00 and the company wants a margin of error of $2.50.
Employees who are paid a salary:
Employees who are paid a salary:are never paid an overtime pay rate because they are considered management.are required to earn overtime if they work more than 50 hours in a week.may be paid overtime based on the results of the “salary level test”.must be paid every two weeks and earn extra paid time off related to the number of hours over 40 they work each week.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT