Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction toming Finishing the Y 2 K Projec At this point, your project should contain the following functions: bool is leap year ( long year

Introduction toming Finishing the Y2K Projec
At this point, your project should contain the following functions:
bool is leap year(long year)
int query for long(string prompt)
int return_days_in_year(long year)
int return days in_month (long year, long month)
int main () that computes the number of days since the beginning of the epoch January 1,1865.
These functions should already be tested as working.
In this assignment, write functions with the prototype:
string return_month_name (Iong month) ;
That returns the name of the month represented by month. The function was presented in class and requires the use of a string array containing the names of each month.
Date return_date (long days_since_epoch) ;
That returns the date represented by days_since_epoch. The function returns a variable of the abstract data type Date that is defined as:
struct Date f
long year ;
long month ;
long day :
;
To accomplish this task, first query the user to enter a year, month, day, compute the number of days since the beginning of our epoch, and display an appropriate message.
This is what the user might see when using the program:
Enter a year: 1870
Enter a nonth: 6
Enter a day: 15
There are 1,992 days between 11?1865 and 615?1870.
1992 represents the date June 15,1870
The bold values above are examples of what the user might type in response to the three queries or are a result of computation performed byit
Include one or more of the following functions:
int query_for_valid_day(long year, long month)
That continually queries the user to enter a valid day that is defined as a value greater than or equal to 1 and less than or equal to the number of days in the month represented by year and month.
int query_for_valid_month()
That continually queries the user to enter a valid month day that is defined as a value greater than or equal to 1 and less than or equal to 12.
int query_for_valid_year()
That continually queries the user to enter a valid year that is defined as a value greater than or equal to 1865.
int return days since epoch (int year, int month, int day)
That packages the statements in the function int main() that computes and returns the number of days since January 1,1865. Once written and tested, replace the statements in the int main 0 function with a call to this function.
At this point, your project should contain the following functions:
bool is_leap_year(long year)
int query_for_long(string prompt)
int return_days_in_year(long year)
int return_days_in_month (long year, long month)
int main (s that computes the number of days since the beginning of the epoch January 1,1865.
These functions should already be tested as working.
In this assignment, write functions with the prototype:
string return_month_name (long month) :
That returns the name of the month represented by month. The function was presented in class and requires the use of a string array containing the names of each month.
Date return_date(long days_since_epoch) ;
That returns the date represented by days_since_epoch. The function returns a variable of the abstract data type Date that is defined as:
struct Date 1
long year ;
long month ;
long day ;
i ;
To accomplish this task, first query the user to enter a year, month, day, compute the number of days since the beginning of our epoch, and display an appropriate message.
This is what the user might see when using the program:
Enter a year: 1870
Enter a month: 6
Enter a day: 15
There are 1,992 days between 11?1865 and 615?1870.
1992 represents the date June 15,1870
The bold values above are examples of what the user might type in response to the three queries or are a result of computation performed by the program,
Include one or more of the following functions:
int query_for_valid_day(long year, long month)
That continually queries the user to enter a valid day that is defined as a value greater than or equal to 1 and less than or equal to the number of days in the month represented by year and month.
int query_for_valid_month()
That continually queries the user to enter a valid month day that is defined as a value greater than or equal to 1 and less than or equal to 12.
int query_for_valid_year()
That continually queries the user to enter a valid year that is defined as a value greater than or equal to 1865.
int return_days_since_epoch(int year, int month, int day)
That packages the statements in the function int main() that computes and returns the number of days since January 1,1865. Once written and tested, replace the statements in the int main 0 function with a call to this function.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions