#include <iostream>
#include <iomanip>
using namespace std;
int main(){
start:
double hourlyRate = 0;
double overtimePay = 0;
double regularPay = 0;
double grossPay = 0;
int hoursWorked = 0;
double overtimeHours = 0;
double otperWeek = 0;
int employeeNo = 0;
char choice;
cout<<"Please Enter Employee Number: ";
while(!(cin>>employeeNo))
{
cout<<"ERROR, Enter a valid Employee Number: ";
cin.clear();
cin.ignore(100,'\n');
}
cout<<"Please enter Hours Worked for the Week: ";
while(!(cin>>hoursWorked))
{
cout<<"ERROR, Enter a valid Hours Worked for the Week: ";
cin.clear();
cin.ignore(100,'\n');
}
cout<<"Please enter hours of Over Time work for the week: ";
while(!(cin>>otperWeek))
{
cout<<"ERROR, Enter a valid hours of Over Time work for the week: ";
cin.clear();
cin.ignore(100,'\n');
}
cout<<"Please enter Hourly Rate:";
while(!(cin>>hourlyRate));
{
cout<<"ERROR, Enter a Valid Hourly Rate: ";
cin.clear();
cin.ignore(100,'\n');
}
if(hoursWorked>=40){
overtimeHours=hoursWorked+otperWeek-40;
hoursWorked=40;
overtimePay=overtimeHours*(1.5*hourlyRate);
}
regularPay=hoursWorked*hourlyRate;
grossPay=regularPay+overtimePay;
cout<<"\nEmployee Number: "<<employeeNo<<endl;
cout<<"Hours Worked: "<<(hoursWorked+overtimeHours)<<endl;
cout<<"Hourly Rate: "<<hourlyRate<<endl;
cout<<"Regular Pay: "<<regularPay<<endl;
cout<<"Overtime Pay: "<<overtimePay<<endl;
cout<<"Gross Pay: "<<grossPay<<endl;
cout<<endl;
question:
{
cout<<"\nTry Another? [Y/N] :\n";
cin>>choice;
if (choice == 'y'|| choice == 'Y')
{
goto start;
}
if (choice == 'N' || choice == 'n')
{
cout<<"\n\n\t-----------------------\n";
cout<<"\t ALLEN JAMES BALANGUE";
cout<<"\n\t SECTION: IT1A\n";
cout<<"\t-----------------------\n";
goto end;
}
else
{
cout<<"\nINVALID INPUT"<<endl;
goto question;
}
} while (choice == 'y'|| choice == 'Y' || choice == 'N' || choice == 'n');
end:
system("pause");
}