Question: This C++ project applying the concepts of inheritance and polymorphism in designing, creating, and using base and derived classes. Class: Time Class: Date This class

This C++ project applying the concepts of inheritance and polymorphism in designing, creating, and using base and derived classes.

Class: Time

This C++ project applying the concepts of inheritance and polymorphism in designing,

Class: Date This class describes a date using year, month, and day. It also provides the ability to check if the current date is the same as another date.

creating, and using base and derived classes. Class: Time Class: Date This

------------------------------------------------------

The following classes are what you will need to design in this project:

Base Class: Appointment Define a class called Appointment which has the following private data fields: 1. Description of the appointment (use the string data type). 2. Start time of the appointment (use the Time type). 3. End time of the appointment (use the Time type).

This class should have the following constructors: 1. A programmer-defined default constructor. 2. A programmer-defined constructor that accepts one incoming parameter value for each private field. These incoming parameter values are for initializing a newly created appointment object.

This class should have the following member functions or overloaded operators: 1. Implementation that allows the display of the start and end time of the appointment (hour:minute) using

Derived Class: Daily Define a class called Daily that inherits from the base class Appointment and handles the daily appointments. This kind of appointment only needs the start time, end time, and description of the appointment since it occurs daily.

Derived Class: Monthly Define a class called Monthly that also inherits from the base class Appointment and handles the monthly appointments. This kind of appointment needs not only the start time, end time, and description of the appointment, but also the day of the month that this appointment re-occurs on monthly.

Derived Class: Onetime Define a class called Onetime that also inherits from the base class Appointment and handles the one-time appointments. In addition to the start time, end time, and description of appointment, this kind of appointment needs to ask the user for the year, month and day of the one-time appointment. For all the derived classes, when a specific date is given (year, month, and day), they need to determine whether the appointment happens on this specific date properly. For example, for a monthly appointment, you must check whether the day of the month matches.

Program: main() Write a program main() that allows a user to enter information of an indefinite number of a mixture of appointments (daily, monthly, or onetime appointments). It also allows the user to enter a date and print out all appointments that happen on that date. The program will run indefinitely until the user chooses to quit. The following is one easy possible implementation of the interaction between the program and the user:

The program shall create and fill a vector of Appointments* with a mixture of appointments added by the user. # The program shall prompt user to choose from one of the following operation: Daily Monthly Onetime Check Quit? (d/m/o/c/q): The user will enter d to enter a daily appointment, m to enter a monthly appointment, o to enter a one-time appointment, c to enter a date to print out all appointments that happen on that date, or enter q to exit the program. # If the user keys in d option to enter a daily appointment, the program shall create a Daily appointment object and invoke its read function to prompt the user to enter the start time, end time, and description of the appointment. Enter start_hours start_mins end_hours end_mins description: The user will enter in the following manner the start time, end time, and the description at the console: hh mm hh mm description of the appointment. For example: If the user wants to add a schedule for daily exercise and breakfast from 6:30 to 7:30, he/she will enter 06 30 07 30 daily exercise and breakfast The program shall then add this appointment to its vector of Appointments*. Then the program shall prompt user to choose from one of the following operation again: Daily Monthly Onetime Check Quit? (d/m/o/c/q): # If the user keys in m option to enter a monthly appointment, the program shall create a Monthly appointment object and invoke its read function to prompt the user to enter the start time, end time, and description of the appointment just like it does with any appointment. Then it needs to ask user to enter the day of the month that this appointment need to reoccur on: Enter day: The user will enter in the day: dd For example: the user may enter 29 The program shall then add this appointment to its vector of Appointments*. Then the program shall prompt user to choose from one of the following operation again: Daily Monthly Onetime Check Quit? (d/m/o/c/q): # If the user keys in o option to enter a one-time appointment, the program shall create a Onetime appointment object and invoke its read function to prompt the user to enter the start time, end time, and description of the appointment just like it does with any appointment. Then it needs to ask user to enter the date (year, month, day) of the appointment: Enter year month date: The user will enter in the day: yyyy mm dd For example: the user may enter 2018 08 16 The program shall then add this appointment to its vector of Appointments*. Then the program shall prompt user to choose from one of the following operation again: Daily Monthly Onetime Check Quit? (d/m/o/c/q):

If the user keys in c option to enter a date to print out all appointments that happen on that date. Then the program needs to ask the user to enter a date (year, month, day) to check the appointments on: Enter year month date: The user will enter in the day: yyyy mm dd For example: the user may enter 2018 08 16 The program should then loop through each of the appointments tracked by the vector, invoking its member function for determining if this appointment occurs on the particular date specified by the user. If this appointment occurs on the date, the program invokes the appointments member function print to display the appointment information on the console. Then the program shall prompt user to choose from one of the following operation again: Daily Monthly Onetime Check Quit? (d/m/o/c/q): # If the user keys in q option, the program shall close, with the window stays on the screen until the user closes it

int remainder(int a, int n) : if(a >= e) : else return a % n; return n- 1- (-a 1) % n; class Time public: : Time(int hour, int min, int sec) { time-in-secs = 6eL 60 * hour + 60 min + sec;} Tine(){ 'time_t now time(e); :struct tm t; localtime_s(&t, &now); time in-secs 6eL * 6e * t.tm hour + 6e * t.tm min + t.tn sec ; int get_hours) const return time_in_secs (60 60) int get minutes() const {return (time in-secs / 68) % 68; } int get-seconds() const { return time in-secs % 6a; } : int seconds_from(Time t) const f return time_in_secs t.time_in_secs; void add-seconds (int s) { time-in-secs remainder(time in-secs 6e 24); } s, * 6e * = + private: int time_in_secs; 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!