Write
prog04a.cpp which is a modification
of your previous Easter date program.
(Start with a copy of prog03b.cpp.)
The
algorithm that you used for computing the date of Easter only works for the
years from 1982 to 2048. However, it
can easily be modified so that it works for any year from 1900 to 2099. The problem is that the program produces a
date that is 7 days later than it should be for the years 1954, 1981, 2049, and
2076. Modify your program (use the
logical operator OR) to check for these years and subtract 7 from the day of
the month.
(The
date of Easter in 1954 is April 18; the date in 1981 is April 19.)
Make
sure your program works correctly.
Now
write prog04b.cpp in which you do
the following things:
1. Open
an input file called prog04b.dat and
an output file called prog04b.out.
2. Print
a heading line.
3. For
each of 5 employees:
a.
Read the
employee’s name, wage, hours, and tax rate.
Compute the salary for the employee (the formula is found below). Print the name, wage, hours, tax rate, and
the salary of the employees.
Regular (less than 40 hours):
salary = wage * hours – (wage * hours *
tax rate)
Overtime
(greater than 40 hours):
salary
= wage * 40 + (wage * 1.5 * (hours – 40)) – (wage * 40 + (wage * 1.5 * (hours –
40)) * tax rate)
b. If an employee works overtime
(greater than 40 hours) print a message about the employee receiving overtime
as found below.
Use
the following data, which you will have to type into prog04b.dat.
Robin 6.50 35 .07
Jan 8.95 40 .12
Jill 7.25 48 .17
Mike 5.60 45 .07
Chris 7.75 39 .12
Make
sure your program works correctly.
Your
output should look like the following:
Name
Wage Hours Tax Rate
Salary
Robin 6.50 35 .07 ?
Jan
8.95 40 .12 ?
Jill 7.25
48 .17 ? Overtime
Mike 5.60 45 .07 ? Overtime
Chris
7.75 39 .12 ?