Question

In: Computer Science

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

Solutions

Expert Solution

Program

Using C++ code:

#include
#include
using namespace std;

int main()
{
int payCode;
int countManager = 0, countHoursWorker = 0,
countCommissionWorker = 0, countPieceWorker = 0, numberOfItems;
const double COMMISSION_PERCENTAGE = .057;//5.7%
double salary, rate, grossWeeklySales, hoursWorked;
cout << fixed << setprecision(2);

do
{
cout << "Enter paycode (-1 to end): ";
cin >> payCode;
switch (payCode)
{
//Manager
case 1:
cout << "Manager is selected\n";
cout << "Enter Salary: ";
cin >> salary;
cout << "Manager's Salary: $" << salary << endl;
countManager++;
break;
//Hours Worker
case 2:
cout << "Hourly worker is selected.\n";
cout << "Enter hourly Salary: ";
cin >> rate;
cout << "Enter the total hours worked: ";
cin >> hoursWorked;
if (hoursWorked > 40)
{
//ovetime
salary = 40 rate + (hoursWorked - 40) rate * 1.5;
}
else
salary = rate * hoursWorked;
cout << "Worker's pay: $" << salary << endl;
countHoursWorker++;
break;
//Commission Worker
case 3:
cout << "Commission worker is selected.\n";
cout << "Enter gross weekly sales: ";
cin >> grossWeeklySales;
salary = 250 + grossWeeklySales * COMMISSION_PERCENTAGE;
cout << "Commission worker's pay: $" << salary << endl;
countCommissionWorker++;
break;
//Piece worker
case 4:
cout << "Piece wroker is selected.\n";
cout << "Enter number of items produced: ";
cin >> numberOfItems;
cout << "Enter rate per item: " << rate;
salary = rate * numberOfItems;
cout << "Piece worker's pay: $" << salary << endl;
countPieceWorker++;
break;
case -1:
break;
default:
cout << "Wrong choice.... try again.." << endl;
break;
}

} while (payCode != -1);
cout << "\nSummary Of Payouts\nEmployee Categories Number Paid.\n";
cout << "-----------------------------------------------------------\n";
cout << "Managers: " << countManager << endl;
cout << "Hourlt Workers: " << countHoursWorker << endl;
cout << "Commission Workers: " << countCommissionWorker << endl;
cout << "Piece Workers: " << countPieceWorker << endl;
}

Output:


Related Solutions

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