Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ELET 2300 Assignment 1 Problem Description A company pays ts employees as manage

ID: 3705539 • Letter: E

Question


ELET 2300 Assignment 1 Problem Description A company pays ts employees as managers (who receive a fixed weekly salary), hourty workers (who receive a fxed hourty wage for up to the first 40 hours they work and 'time-and-a-half, ie 1.5 times their hourly wage, for overtime hours worked). commission workers (who receive $25o plus S7% of ther gross weekly Sales, or pieceworkers (who receive a fixed amount of money per item tor each of the tems they produce each pieceworker in this company wor'ks 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 ot 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 employee's pay based on that employee's paycode. appropriate facts your program needs to calculate each SampleOutput Enter paycode (-1 to endl: 3 Commission worker selecied Enter gross weekly saies 4000 Commission workers pay is $ 478.00 Enter paycode (-t to end).2 Hourty 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 o Piece Workers 0 Important Notes : Your fie must be virus FREE (Zero will be given for infected fie

Explanation / Answer

#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<<" Enter paycode (-1 to end): ";
cin>>paycode;
if(paycode == -1)
break;

switch(paycode)
{
  case 1:
  cout<<" Manager selected.";
  mgrCount++;
  break;
  
  case 2:
  cout<<" Hourly worker is selected.";
  cout<<" Enter hourly salary: ";
  cin>>hourlySalary;
  cout<<" Enter the total hours worked: ";
  cin>>hoursWorked;
  cout<<" Worker’s pay is $"<<hourlySalary*hoursWorked;
  hworkersCount++;
  break;
  
  case 3:
  cout<<" Commission worker selected.";
  cout<<" Enter gross weekly sales: ";
  cin>>grossWeeklySales;
  cout<<" Commission worker’s pay is $ "<<250+grossWeeklySales*0.057;
  cworkersCount++;
  break;
   
  case 4:
  cout<<" Piece worker is selected.";
  cout<<" Enter money per item :";
  cin>>moneyPerItem;
  cout<<" Enter the number of items : ";
  cin>>items;
  cout<<" Piece worker’s pay is $ "<<moneyPerItem*items;
  pworkersCount++;
  break;
  
  default:
  cout<<" Invalid paycode.";
  break;
  
  
}
}while(paycode != -1);
cout<<" Summary of Payouts";
cout<<" Employee Categories Number Paid";
cout<<" —————————— —————–";
cout<<" Managers "<<mgrCount;
cout<<" Hourly Workers "<<hworkersCount;
cout<<" Commission Workers "<<cworkersCount;
cout<<" Piece 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.