Day Calculation Part II
Many computer
applications, such as Microsoft Excel, can compare date values that occur after
January 1, 1900. For example, these
programs can determine if 06/06/99 is
less than (comes before) 11/01/00. They use
January 1, 1900 as their reference point.
This becomes day 1. All other
dates are calculated as to the number of days they are relative to January 1,
1900. For example January 2, 1900 is
equal to 2. October 31, 2000 is equal to
36829
Most software these
days is not written from scratch.
Software developers will reuse code written for other applications or
add on to current applications. In Part
I we calculated the number of days since January 1 of a year to the date
specified in the same year. For this lab
we will expand on this to calculate the number of days from January 1, 1900 to
a given date.
For this assignment,
you are to write a C++ program which will:
1.
Read a set of dates from an input
file. You do not know in advance how
much input you will need to process.
This means you need to read to
end of file. The date is represented
as a month, a day and a year, separated by spaces.
2. Calculate the number of days from January 1, 1900 to December 31 of the
previous year. For example, if your date
reads:
4 22 1995
You will calculate the number of days from January
1 1900 to December 31 1994.
Keep in mind that non leap years have 365 days and
leap years have 366 days.
3.
Use your code from Lab 4 to add to the
calculation from number 3 above to calculate the total number of days from
January 1, 1900 to your given day.
Output - Organize your output in a neat orderly fashion. Print your results to an output file. Write a statement indicating the number of
days since January 1, 1900 to the year before your current year. Part of your grade calculation reflects how
readable your output is.
HAND IN
1) Your source code
2) Your input file
3) Your output file
4) Grading Rubric with
your name printed on the top. Attach as
page 1 of your package.