inserting a switch for my menu instead of using while (option == 2) and also the program is supposed to re run for the number of workers you put in.
#include <iostream>
using namespace std;
int main()
{
double workers;
double option;
double hours;
double wage;
double sales;
double items;
double salary;
int i;
cout << "Enter the number of workers that will be included in the weekly salary calculation: ";
cin >> workers;
cout << endl;
cout << " ** PAYROLL MENU **" << endl;
cout << "1 - Manager\n";
cout << "2 - Salary\n";
cout << "3 - Commision Worker\n";
cout << "4 - Piece worker\n";
cout << endl;
cout << "Select the type of worker to pay: ";
cin >> option;
while (option == 1) {
salary = 1875.00 * workers;
cout << "The current weekly salary is: $" << salary;
break;
}
while (option == 2) {
cout << "Enter the amount of hours worked: ";
cin >> hours;
if (hours > 40) {
cout << endl;
cout << "enter the wage per hour: ";
cin >> wage;
cout << endl;
salary = (40 * wage) + ((hours - 40) * (wage * 1.5));
cout << "The current weekly salary is: $" << salary; // IDK if i did the overtime part correctly but it works
if
}
cout << endl;
cout << "enter the wage per hour: ";
cin >> wage;
cout << endl;
salary = hours * wage * workers;
cout << "The current weekly salary is: $" << salary;
break;
}
while (option == 3) {
cout << "Enter the gross weekly sales: ";
cin >> sales;
cout << endl;
salary = 250 + (.0057 * sales) * workers;
cout << "The current weekly salary is: $" << salary;
break;
}
while (option == 4) {
cout << "enter the number of items produced this week: ";
cin >> items;
cout << endl;
salary = items * 6.89 * workers;
cout << "The current weekly salary is: $" << salary;
break;
}
return 0;
}