// Mwape Mulenga
#include <iostream>
using namespace std;
int main()
{
int x; //The main variable used for switch
float hwage, y, wpay, wpay2, wpay3, wpay4, gsales, fpay, z; //The variables used for calculating each switch
do
{
cout << "\nEnter Paycode (-1 to end): "<< endl; //Function used to select correct switch for caculating payment while also ending payment
cin >> x;
switch (x) //Function used to select payment
{
case 1: //Switch calculates payment for manager
cout << "\nManager Selected" << endl;
cout << "\nEnter Payment: " << endl;
cin >> wpay;
cout << "\nManger receives $" << wpay << " as payment."<< endl;
break;
case 2: //Switch calculates payment for hourly worker
cout << "\nHourly worker selected" << endl;
cout << "\nEnter hourly wage: " << endl;
cin >> hwage;
cout << "\nThe hourly wage is " << hwage;
cout << "\nEnter the total hours worked: " << endl;
cin >> y;
cout << "\nThe total hours is " << y;
if (y >= 40)
{
wpay2 = 1.5*(hwage-40) + hwage*y;
cout << "\nThe weekly pay for the hourly worker is: " << wpay2;
}
else
{
wpay2 = hwage*y;
cout << "\nThe weekly pay for the hourly worker is: " << wpay2;
}
break;
case 3: //Switch calculates payment for commission worker
cout << "\nCommission worker selected" << endl;
cout << "\nEnter the amount of commission:" << endl;
cin >> gsales;
wpay3 = 250 + (.057 * gsales);
cout << "\nThe commission worker's pay is: " << wpay3 << endl;
break;
case 4: //Switch calculates payment for pieceworker
cout << "\nPieceworker selected" << endl;
cout << "\nEnter Payment: " << endl;
cin >> fpay;
cout << "\nEnter the total amount of items worked: " << endl;
cin >> z;
cout << "\nThe total hours is " << z;
wpay4 = fpay*z;
cout << "\nPieceworkers receives $" << wpay4 << " as payment."<< endl;
break;
case -1: //Switch ends loop sequence with message signifying end of payments
cout << "\nAll payments have been made" << endl;
break;
default: //Switch repeats loop as a invalid number was selected
cout << "\nIncorrect payment code! Try again!"<< endl;
break;
}
}while (x != -1);
return 0;
}