In this chapter, the class dateType was designed to implement the date in a program, but the member function setDate and the constructor do not check whether the date is valid before storing the date in the member variables. Rewrite the definitions of the function setDate and the constructor so that the values for the month. day, and year are checked before storing the date into the member variables. Add a member function. isLeap Year. to check whether a year is a leap year. Moreover, write a test program to test your class. Input should be format month day year with each separated by a space. Output should resemble the following: Date #: month-day-year An example of the program is shown below: Date 1: 3-15-2008 this is a leap year If the year is a leap year, print the date and a message indicating it is a leap year, otherwise print a message indicating that it is not a leap year. The header file for the class dateType has been provided for you. Grading When you have completed your program, click the Submit button to record
Programming Exercise 11-2
dateType.h file providedTrending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
I also am struggling with this project but do not understand this code. The problem I have uses a main.cpp file alongside a dateTypelmp.cpp file. This solution does not solve the task as I understand it to be.
The class dateType was designed to implement the date in a program, but the member function setDate and the constructor do not check whether the date is valid before storing the date in the member variables.
Function setDate and the constructor need to be rewrit so that the values for the month, day, and year are checked before storing the date into the member variables. A member function should be included, isLeapYear, to check whether a year is a leap year.
Input should be format month day year with each separated by a space. Output should resemble the following:
Date #: month-day-year
If the year is a leap year, print the date and a message indicating it is a leap year, otherwise print a message indicating that it is not a leap year.
The header file for the class dateType has been provided.