Question
C++ Working with classes (all written below is a single exercise): Define a Date class that contains integer variables for the day, month, and year.
C++
Working with classes (all written below is a single exercise):
Define a Date class that contains integer variables for the day, month, and year. 1.1. Create methods for the class: set, get, default constructor, constructor with arguments.
1.2. Create a method that calculates the number of days between two dates (objects) passed to it.
1.3. Create a dateUpdate method that calculates the next day (assuming there are 30 days in each month)
Define a Time class that contains integer variables for hours and minutes. The Time class inherits the Date members. 2.1. Create methods for the class: set, get, default constructor, constructor with arguments.
2.2. Create a timeUpdate method that calculates time in one minute.
2.3. Create a dateAndTime method that calculates the time in one minute with the date in mind (if at 23:59, one minute will be 00:00 the next day; if the same time is December 31, one minute will be the New Year ).
Write a program implementation demonstrating all methods in both classes. The code should include comments describing the written program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started