1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float reghours=0, overtime=0, overtimepay, grossweeklysales, commisionpay, commision, pieces, grosspay, hourlywage=0, piecepay;
int n;
n = 1,2,3,4;
enum Etype {Manager, Hourly, Commision, Piece};
cout<<" Please enter the approprate employee code to be figure. Enter 1 for Managers, 2 for Hourly workers, 3 for Commissioned workers, and 4 for Piece workers: ";
cin>> n;
switch (n) {
case 1:
cout<< "The Manager will receive 1000 dollars for the week.";
break;
case 2:
cout<< "Please enter the number of hours worked between 1 and 40: ";
cin>>reghours;
do {
if (reghours >=41) {
cout<< "Hours must be between 1 and 40, please reenter hours worked: ";
cin>>reghours;
}
} while (reghours >=41);
do {
if (reghours <=0) {
cout<< "Hours must be between 1 and 40. Please reenter hours worked: ";
cin>>reghours;
}
} while (reghours <=0);
cout<< "Please enter the number of hours worked over 40: ";
cin>>overtime;
do {
if (overtime >=81) {
cout<< "Overtime hours cannot be greater than 80. Please reenter the number of overtime hours worked: ";
cin>>overtime;
}
} while (overtime >=81);
cout<< "Please enter the hourly rate pay to this employee: ";
cin>>hourlywage;
do {
if (hourlywage >=251) {
cout<< "No employees within this company are paid more than 250 dollars per hour. Please reenter the hourly rate for this employee: ";
cin>>hourlywage;
}
} while (hourlywage >=251);
do {
if (hourlywage <=0) {
cout<< "Hourly wage must be a minimum of 1 dollar per hour. Pleaser reenter the hourly rate for this employee: ";
cin>>hourlywage;
}
} while (hourlywage <=0);
overtimepay = overtime * (1.5 * hourlywage);
grosspay = (reghours * hourlywage) + overtimepay;
cout<< "This employees pay for the week is: " << grosspay << endl;
break;
case 3:
cout<< "Please enter the amount of gross weekly sales this employee contibuted to: ";
cin>>grossweeklysales;
commisionpay = (grossweeklysales / 5.7) + 250;
cout<< "This emloyees pay for the week is: " << commisionpay <<endl;
break;
case 4:
cout<< "please enter the number of peices this employee completed: ";
cin>>pieces;
do {
if (pieces >= 100); {
cout<< "Employees are not allowed to produce more than 100 units per week. Please reenter the number of units produced this week: ";
cin>>pieces;
}
} while (pieces >=101);
do {
if (pieces <0); {
cout<< " Employees cannot produce a negative number of pieces. Please reenter the number of pieces produced: ";
cin>>pieces;
}
} while (pieces <0);
piecepay = pieces * 50;
cout<< "This employees pay for the week is: " << piecepay <<endl;
break;
}
}
|