Question: This should be a C++ program Suppose you have a class named Clock that represents a clock. Your class has private variables hours, minutes, and
This should be a C++ program
Suppose you have a class named Clock that represents a clock. Your class has
private variables hours, minutes, and seconds. Your class also has the following
two constructors and a method: Clock( ), Clock(int hr, int min, int
sec), and void setClock(int hr, int min, int sec).
You will define a derived class named AlarmClock to represent an alarm clock. Use
the Clock class as your base class. The AlarmClock class should include a time (i.e.
variables alarmHours, alarmMinutes, alarmSeconds) to sound the alarm,
two constructors, and two methods: AlarmClock( ), AlarmClock(int hr,
int min, int sec), void setAlarmClock (int hr, int min, int
sec), and AlarmClock getAlarmClock().
In this assignment you will write the class definitions of the above two classes, and
also a program that contains the main function where you create an object of
AlarmClock. In the main function, write statements to call setAlarmClock to set
the time to all zeros, and call getAlarmClock to get an object of AlarmClock and
display all the time (i.e. hours, minutes, seconds, alarmHours,
alarmMinutes, alarmSeconds) of the object.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
