A. Define and implement the class Alarm as follows: The class Alarm consists of two private...

80.2K

Verified Solution

Question

Programming

A. Define and implement the class Alarm as follows: The classAlarm consists of two private member variables: description of typestring and atime of type Time. The class Alarm also includes thefollowing public member functions:

1. print to print out the alarm’s description and hour, minute,and second of the alarm time.

2. setDescription to accept a string argument and use it to setthe description member variable.

3. setAtime to accept three integers (for hour, minute, andsecond) to set the atime member variable (alarm time).

4. getDescription to return the value of the description membervariable.

5. getAtime to return the atime member as a Time object.

6. A default constructor that initializes the description to thestring “None” and the alarm time to 00:00:00.

7. An overloaded constructor that accepts a string argument forthe alarm description and three int arguments (as the hour, minute,and second) and use them to initialize the description and atimemember variables of an Alarm object.

8. An overloaded constructor that accepts a string argument forthe alarm description and a Time object and use them to initializethe description and atime member variables of an Alarm object. 9.An equals function to compare two Alarm objects’ values. Returntrue if both objects have the same values of the member variables.Otherwise, return false. B. In the function main, write statementsto declare Alarm class objects and test your classimplementation.

Your project is expected to contain five source files: Time.h,Time.cpp, Alarm.h, Alarm.cpp, Lab8.cpp.

Answer & Explanation Solved by verified expert
3.6 Ratings (386 Votes)
Following c application demonstrates the use Time AlarmclassesTime class has hrs min secAlarm class has alarm description hrs min secInstantiates alarm objects with different inputsChecks two alarm objects whether they are equal or notPFB source code with sample outputTimehincludeifndef TimeH define TimeHusing namespace stdclass Time privateint    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students