Question: In Chapter 10, the class Date was designed to implement the date in a program, but the method setDate and the constructor with parameters do
In Chapter 10, the class Date was designed to implement the date in a program, but the method setDate and the constructor with parameters do not check whether the date is valid before storing the date in the data members. Rewrite the definitions of the method setDate and the constructor with parameters so that the values of month, day, and year are checked before storing the date into the data members. Add a method isLeap Year to check whether ayear is a leap year. Then, form a test program to test your class. The following link is an example of an algorithm for finding leap year. It gives a flowchart, a pseudocode example, and a code example in the C language. This should be sufficient to help you write the isLeapYear() method. https://www.tutorialspoint.com/learn_c_by_examples/leap_year_program_in_c.htm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
