In: Computer Science
CODE IN C++:
#include <iostream>
#include<string>
using namespace std;
int main()
{
string firstName,lastName;
int hoursWorked;
double
hourlyPayRate,grossPay,netPay,deductions,regularPay,overTimePay=0.0;
cout <<"Enter Employee FristName:";
cin>>firstName;
cout <<"Enter Employee LastName:";
cin>>lastName;
cout << "Enter hourly Pay Rate:";
cin>>hourlyPayRate;
cout<<"Enter hours worked:";
cin>>hoursWorked;
if(hoursWorked>40){
overTimePay = (hoursWorked-40) * 1.5 * hourlyPayRate;
regularPay = hoursWorked * hourlyPayRate ;
}
else
regularPay = hoursWorked * hourlyPayRate ;
grossPay = regularPay + overTimePay ;
deductions = grossPay * 0.20 ;
netPay = grossPay - deductions ;
cout<<"\n\nEmployee
FirstName:"<<firstName<<endl;
cout<<"Employee LastName:"<<lastName<<endl;
cout<<"Employee
hourlyPayRate:"<<hourlyPayRate<<endl;
cout<<"Employee
hoursWorked:"<<hoursWorked<<endl;
cout<<"Employee
regularPay:"<<regularPay<<endl;
cout<<"Employee
overTimePay:"<<overTimePay<<endl;
cout<<"Employee grossPay:"<<grossPay<<endl;
cout<<"Employee
deductions:"<<deductions<<endl;
cout<<"Employee netPay:"<<netPay<<endl;
return 0;
}
OUTPUT: