Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int paycode, TotalHours, Pieces, TotalManagers, TotalHourlies, TotalCommissioners, TotalPieceworkers;
- double pay, HourlySalary, PieceWage, WeeklySalary, WeeklySales;
- while (paycode != -1)
- {
- cout << "Enter paycode (-1 to end): ";
- cin >> paycode;
- if (paycode < 1 || paycode > 4)
- {
- cout << "You must enter a paycode between 1 and 4.";
- cout << endl;
- }
- switch (paycode)
- {
- case 1:
- cout << "Manager selected." << endl;
- TotalManagers++;
- cout << "Enter weekly salary: ";
- cin >> WeeklySalary;
- pay = WeeklySalary;
- cout << "Manager's pay is $" << pay << endl;
- break;
- case 2:
- cout << "Hourly worker selected." << endl;
- TotalHourlies++;
- cout << "Enter the hourly salary: ";
- cin >> HourlySalary;
- cout << "Enter the total hours worked: ";
- cin >> TotalHours;
- if ( TotalHours <= 40)
- pay = HourlySalary * TotalHours;
- else
- pay = (40 * HourlySalary) + (TotalHours - 40) * (HourlySalary * 1.5);
- cout << "Worker's pay is $" << pay << endl;
- break;
- case 3:
- cout << "Commission worker selected." << endl;
- TotalCommissioners++;
- cout << "Enter gross weekly sales: ";
- cin >> WeeklySales;
- pay = (WeeklySales *.057) + 250;
- cout << "Commission worker's pay is $" << pay << endl;
- break;
- case 4:
- cout << "Pieceworker selected." << endl;
- TotalPieceworkers++;
- cout << "Enter number of pieces: ";
- cin >> Pieces;
- cout << "Enter wage per piece: ";
- cin >> PieceWage;
- pay = Pieces * PieceWage;
- cout << "Pieceworker's pay is $" << pay << endl;
- break;
- }
- }
- cout << "Employee Category Number Paid\n";
- cout << "Managers: " << TotalManagers << endl;
- cout << "Hourly Workers: " << TotalHourlies << endl;
- cout << "Commission Workers: " << TotalCommissioners << endl;
- cout << "Pieceworkers: " << TotalPieceworkers << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement