Question
I have the question and the answer but I need to apply While loop Payroll: include input validation for the Hours (0-60) Rate (15-50) Apply
I have the question and the answer but I need to apply
While loop
Payroll: include input validation for the
Hours (0-60)
Rate (15-50)
Apply while loop to repeat the program
Calculate overall gross (accumulator)
Display how many time you run the program (counter)
Display the gross ave(Acc/count )
Write c++ program which accepts employees information such as first name, last name middle initial, ID number, hours work, rate per hours employee is to pay union
Fees 7% of gross and 15% in taxes
Calculate the gross, union fees , taxes and net
Formulas if hours work <= 40
Gross = hours worked * rate per hour
Hours worked > 40
Gross =(40*rate per hour)+(hours worked -40)*(rate per hour* 1.5)
Output
Company xyz
Firs name:
Middle initial :
Last name :
ID:
Hours worked :
Rate per hour :
Gross :
Union:
Taxes:
Net:
#include
using namespace std;
main()
{
string company, fname, initial, lname, id;
float hours, rph, gross, unionFee, taxes, net;
cout << "Enter compnay : ";
getline(cin, company);
cout << "Enter first name : ";
cin >> fname;
cout << "Enter middle inital : ";
cin >> initial;
cout << "Enter last name : ";
cin >> lname;
cout << "Enter id : ";
cin >> id;
cout << "Enter hours worked : ";
cin >> hours;
cout << "Enter rate per hours : ";
cin >> rph;
if (hours <= 40)
gross = hours * rph;
else
gross = (40 * rph) + (hours - 40) * (rph * 1.5);
unionFee = gross * .07;
taxes = gross * .15;
net = gross - unionFee - taxes;
cout << "Company: " << company << endl;
cout << "Firs name:" << fname << endl;
cout << "Middle initial :" << initial << endl;
cout << "Last name :" << lname << endl;
cout << "ID:" << id << endl;
cout << "Hours worked :" << hours << endl;
cout << "Rate per hour :" << rph << endl;
cout << "Gross :" << gross << endl;
cout << "Union:" << unionFee << endl;
cout << "Taxes:" << taxes << endl;
cout << "Net: " << net << endl;
} // main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started