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

C++ programming, do not use class. A company pays its employees as managers (who

ID: 3821577 • Letter: C

Question

C++ programming, do not use class.

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

Important Notes

o Your file must be virus FREE (Zero will be given for infected file).

o Your program must include appropriate code comments,

Explanation / Answer

The following program imlements the above given scenario.I have included what the program is doing in the cout statements to make it simple to understand.

#include<stdio.h>

#include<iostream.h>

#include<math.h>

#include<stdio.h>

int main(void){

              

               int pay_code;

               int weeks;

               int numhoursWorked=0;

               int numberOfPieces;

              

               int countManager=0;

               int countHourlyWorker=0;

               int countCommissionWorker=0;

               int countPieceWorker=0;

              

               double salaryofManager;

               double salaryofHourlyWorker;

               double grossWeeklySalaryCommission;

               double value_piece;

          double p;

          double q;

                  double l;

               double m;

        double s;

         double z;

              

               cout<<"Enter Paycode(-1 to quit)";

               cin>>pay_code; /* enter the paycode */

              

               while (pay_code!=-1){

                              

                              

                              

                               switch(pay_code){

                                             

                                             

                                              case 1:{

                                              cout<<" The Manager is selected.Enter the salary of          the manager “;

                                                             cin>>salaryofManager;

                                                            

                                                             cout<<salaryofManager;

                                                            

                                                             countManager++;

                                                            

                                                             break;

                                              }

                                             

                                              case 2:{

                                                             cout<<” The Hourly worker is selected. Enter the salary for one hour”;

                                              cin>>salaryofHourlyWorker;

                                                            

                                                             cout<<"Enter the hours this person works for";

                                              cin>>numhoursWorked;

                                                            

                                                             if(numhoursWorked<=40)

                                                                            {cout<<("The hourly worker's salary is ";

                 p=(numhoursWorked*salaryofHourlyWorker);

                   cout<<p;}

                                                             else

                                                             {cout<<"The worker's salary is ";

q=((salaryofHourlyWorker*40)

s=((numhoursWorked-40.0)*(salaryofHourlyWorker*1.5)) ;

                            z= q+s;

cout<<z;}

                                                                           

                                                             countHourlyWorker++;

                                                            

                                                             break;

                                              }

                                             

                                              case 3:{

                                                             cout<<"The Commission worker is selected,Enter the gross weekly salary of the commission worker";

                                                             cin>>grossWeeklySalaryCommission;

                                                            

                                                             cout<<"Commission Worker's salary is ";

l=(grossWeeklySalaryCommission*0.057)+250;

cout<<l;

                                                             countCommissionWorker++;

                                                            

                                                             break;

                                              }             

                                                                           

                                              case 4:{

                                                            

cout<<"Piece worker selected and enter the number of pieces produced by the commission worker";

                                                             cin>>numberOfPieces;

                                                            

                                                             cout<<"enter the per piece value for every piece";

                                                             cin>>value_piece);

                                             

cout<<"Piece Worker's salary is";

m=(value_piece*numberOfPieces);

cout <<m;

                                                             countPieceWorker++;

                                                             break;

                                              }                                            

                               }

                              

                               cout<<"Enter Paycode(-1 to quit)";

                               cin>>pay_code;

                              

                              

               }

              

        cout<<”the number of managers is:”<<countManager,

      cout<<”the number of hourlyworkers is:”<<countHourlyWorker;

    cout<<”the number of commission workers is:”<<countCommissionWorker;

cout<<”the number of pieceworkers is:”<<countPieceWorker;

       

        return 0;

}

OUTPUT:

Enter paycode (-1 to end): 3

The Commission worker is selected,Enter the gross weekly salary of the commission worker:4000

Commission Worker's salary is

478.00

Enter paycode (-1 to end): 2

The Hourly worker is selected. Enter the salary for one hour:4.5

Enter the hours this person works for: 20

The hourly worker's salary is $90.00

Enter paycode (-1 to end): -1

the number of managers is:0

the number of hourlyworkers is: 1

the number of commission workers is: 1

the number of pieceworkers is: 0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote