Write a program to compute the gross pay and net pay for five (5)employees. Your
ID: 3609372 • Letter: W
Question
Write a program to compute the gross pay and net pay for five (5)employees. Your program will get its input from afile named "pa3.input" – and you must create this file. Thefile must contain five (5) lines of data, where each line
contains two (2) floating point numbers. The first number indicatesthe number of hours the employee has worked,
and the second number indicates the hourly rate for thatemployee.
First compute the employee's gross pay. Gross pay is hours workedmultiplied by hourly rate. We will assume (for
simplicity) that no employee will work more than 40.0 hours,therefore no overtime pay calculation is needed.
Next, compute the net pay. To do so, we must determine the amountof taxes to withhold. For simplicity we will
assume workers who make less than $300 have only 12% of their paywithheld for taxes. However, workers who
make at least $300, but less than $400 have 17% of their paywithheld for taxes. And finally, workers who make at
least $400 have 20% of their pay withheld for taxes.
You must have named constants for each of these dollar amounts andpercentages, and you must use them in your
programming statements.
Finally, you must calculate these values for all the employees inthe input file. Once you've computed all employees'
gross and net pays, print all data to the screen.
Explanation / Answer
please rate - thanks I was bored-next time I'm not so nice #include #include #include using namespace std; #define TWELVE .12 #define SEVENTEEN .17 #define TWENTY .20 #define HUNDRED3 300 #define HUNDRED4 400 int main() { double hours[5],rate[5],gross[5],net[5],tax[5]; int i, n=5; ifstream in; cout.setf(ios::fixed,ios::floatfield); cout.precision(2); in.open("pa3.input"); //open file if(in.fail()) //is it ok? { cout>rate[i]; gross[i]=hours[i]*rate[i]; if(gross[i]Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.