These are the instructions for your fourth programming project. Recall that all code must be written individually and independently. Recall that violating this rule will result in zero credit for the project and probably a failing grade in the course.
For this project, you will turn in your algorithm one week before the project is due. Your algorithm should serve as pseudocode that you can translate into c++ code. It should be indented similarly to source code to clearly show how the nesting of loops and control structures will be in your final program. You should have an algorithm for your main program, as well as each of the functions in the program. The algorithm you turn in will be worth 10% of the program grade.
This program will ask the user to input a date, including the month, day of the month, and year. This date can be any date after September 14, 1752 (that is the first day we started using the Gregorian calendar, the calendar we are still using today). First it will check that this is a valid date, and output a message if it is not (for example, February 30 is not a valid date, nor is August 15, 1731). Next, it will calculate and display what day of the year that day is (for example, March 3, 2002 is the 62nd day of the year). Next, it will figure out and display what day of the week it is (for example, October 18, 2002 is a Friday).
Your program should repeat the above process, until the user no longer wants to continue. You may choose the format that the user enters the information. For information about how many days there are per month, see this Nursery Rhyme. It might also turn out useful to know that September 14th, 1752 was a Thursday.
Your program must be organized using functions. The following is a list of functions that your program should include.
bool is_leap_year(int year);
int days_per_month(int month, int year);
int day_of_year(int month, int day, int year);
bool is_valid_date(int month, int day, int year);
int days_since_beginning(int month, int day, int year);
string day_of_week(int month, int day, int year);
ftl> project4
Please input the month: 3
Please input the day: 1
Please input the year: 2000
That is day number 61 of the year.
It is a Wednesday
Do you want to continue? y
Please input the month: 10
Please input the day: 21
Please input the year: 2002
That is day number 294 of the year.
It is a Monday
Do you want to continue? y
Please input the month: 9
Please input the day: 15
Please input the year: 1752
That is day number 259 of the year.
It is a Friday
Do you want to continue? y
Please input the month: 2
Please input the day: 29
Please input the year: 1900
That date is not valid
Do you want to continue? y
Please input the month: 9
Please input the day: 10
Please input the year: 1752
That date is not valid
Do you want to continue? n
ftl>
Instructions for submitting:
As always, don't forget that your program should start with a few lines of
comments giving your name, the date, the course this is for, and
the assignment number. You should also include a few lines that describes
what the program does and how to use it. The program should be written with
a well organized
structure, and the variables should be named in a useful way.
The program should be formatted consistently and clearly, and should
include comments that explain the code. The program should compile without
any compiler warnings.
When you're done writing and testing the program, print out a copy
of your source code. Also print out a copy of the output of your program,
which shows how the program works for several different dates.
Bring these to class on the due date and turn them in at the beginning of class.
Also, before the beginning of class on the due date, mail your source
code (your ".cpp" file) to comp1671@cs.du.edu. Do not include it as the
message, instead make it an attachment to the email.