Question: *** USE C++ *** Topic Branching switch Statement Description Write a program that converts a date into its corresponding day number. The program asks the
*** USE C++ ***
Topic
Branching
switch Statement
Description
Write a program that converts a date into its corresponding day number. The program asks the user to input any date within the current century as three whole numbers representing month, day, and year. It computes the day number corresponding to the date entered and displays it. For example, for a month value of 3, day value of 1, and year value of 2007, it displays 60.
Details
Each day of the year has a day number associated with it from 1 to 365/366. For example, for a non-leap year the day number for January 1st is 1, for March 1st is 60 and for December 31st is 365. For a leap year, the day number for January 1st is 1, for March 1st is 61 and for December 31st it is 366.
This assignment limits the year to be within the current century i.e. from 2000 to 2099. This makes it easier to determine the leap year. Within the above range, a leap year is the year that is divisible by 4.
Testing
Input Test Run 1
Enter Month: 2
Enter Day: 29
Enter Year: 2004
Output Test Run 1
Date: 2/29/2004
Day Number: 60
Input Test Run 2
Enter Month: 3
Enter Day: 1
Enter Year: 2003
Output Test Run 2
Date: 3/1/2003
Day Number: 60
Input Test Run 3
Enter Month: 3
Enter Day: 1
Enter Year: 2004
Output Test Run 3
Date: 3/1/2004
Day Number: 61
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
