Write
prog05a.cpp in which you do the
following things:
1. Open an input file called prog05a.dat and an output file called prog05a.out.
2. Print
header lines.
3. For
each of 4 cars:
a. Read a car's name, miles traveled,
and gallons of gas used.
b. Calculate the number of miles per
gallon.
c. Print the car's name, miles
traveled, gallons of gas used and miles per gallon.
4. After
the loop is finished print a trailing line as indicated below.
Use
the following input:
Lincoln 100 6
Honda 200 7
Ford 150 8
Toyota 180 8
Your
output should look like the following:
Name Miles Gallons MPG
---- ----- ------- ---
Lincoln 100 6 16.7
Honda
200 7
28.6
Ford
150 8
18.8
Toyota
180 8
22.5
The
cars have all been processed.
Make sure your program works correctly.
Now
write prog05b.cpp to do the
following things:
1. Open an input file called prog05b.dat and an output file called prog05b.out.
2. Print
a header line.
3. For
3 employees
a. Read an employee's name, hours
worked, and pay rate
b. Print the person's name, gross
salary, tax, and net salary. (Assume a
10% tax rate.)
4. Print
a line containing the sums after the loop is finished, as indicated below.
Use
the following input:
Davis 40 10.00
Bonnie 35 9.00
Jenn 40 8.00
Your
output should look like the following:
Name Gross Salary Tax Net Salary
Davis 400.00 40.00 360.00
Bonnie 315.00 31.50 283.50
Jenn 320.00 32.00 288.00
Totals 1035.00 103.50 931.50
Make
sure your program works correctly.