Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

2 . List all of the common exercise testing protocols

Answered: 1 week ago