Question: Create the following 2 classes named Date,Time. These classes should have setting and getter methods for all items. Date - The setter methods should confirm
Create the following 2 classes named Date,Time. These classes should have setting and getter methods for all items.
Date - The setter methods should confirm the proper ranges for the items below:
1. Month - 1-12
2. Day of Month - 1-31 // This is of course dependent on the Month and also Year value. Do not do the extra validation. Just 1-31.
3. Year - 1900-2100
Additionally, write an extra class level display method:
displayYMD - Display the date in Year/Month/Day format.
The Date class needs a default constructor that sets the Year to 1900, Month to 1, and Day of Month to 1.
Time - The setter methods should confirm the proper ranges for the items below:
Hour 0 - 11
AM - PM indicator
Minute 0-59
Second 0-59
Additionally, write 2 extra class level display methods
displayFullTime - displays the time in Hour:Minute:Second format
displayMilitaryTime - if the time is PM indicated, then add 12 to the hour and display the time in Hour:Minute:Second format
The time class needs a default constructor that sets the Hour, Minute & Seconds to 0 and the AM-PM indicator to AM.
Create a program that will prompt me for each of the following items:
1. Date of Birth - instance of Date. Prompt for data, load data into the class and call the class's displayYMD method.
2. Typical wake up Time - Instance of Time. Prompt for data, load data into the class and call the class's displayFullTime and displayMilitaryTime methods.
Do not use cin statements inside the class definitions. You can use cout statement in the display_ methods.
Deliverable is a working CPP file and a UML diagram for Date and Time classes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
