Question: Description In a Visual Studio C++ project named using the format firstname_lastname_0301 CSCdate class Create the CSCdate class (CSCdate.h and CSCdate.cpp) CSCdate -day: int -month:
Description
In a Visual Studio C++ project named using the format
firstname_lastname_0301
CSCdate class
Create the CSCdate class (CSCdate.h and CSCdate.cpp)
| CSCdate |
| -day: int -month: int -year: int |
| +setDay(int d): void +getDay() const: int +setMonth(int m): void +getMonth() const: int +getMonthName() const: string +setYear(int y): void +getYear() const: int CSCdate(int d=1, int m=1, int y=1800) |
The constructor receives the day, month, and year as input.
getDay, getMonth, and getYear are accessors that returns the value of the respective variable. getMonthName returns the corresponding name of the month value.
setDay, setMonth, and setYear are mutators that change the value of the respective variable.
Business rules
Day can only be between 1 and 31. If setDay receives an invalid value, it does not change the day value.
Month can only be between 1 and 12. If setMonth receives an invalid value, it does not change the month value.
Year can only be between 1800 and 2022. If setYear receives an invalid value, it does not change the year value.
If the constructor receives an invalid value in day, month, or year; change the corresponding variable to the default values: 1, 1, 1800, respectively.
Note: Due to time limitation, this class does not verify if a full date is valid e.g. February 30, April 31, etc.
In the main function
Create an object of CSCdate class. Use the no-argument constructor.
Display the date using the accessors getDay, getMonth, and getYear.
Modify the object's day, month, and year.
Display the date using the accessors getDay, getMonth, and getYear.
Create another CSCdate object using a valid date in the constructor.
Display the date using the accessors getDay, getMonthName, and getYear.
Submission
Expected files:
- VS Solution and project -related files.
- main file (.cpp).
- CSCdate.h and CSCdate.cpp
Submit the VS project with your solution in a ZIP file.
Example of expected output
CSCdate app! ---------------------------------- First CSCdate: 1-1-1800 Updated first CSCdate: 21-4-2005 Second CSCdate: 18-June-2021
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
