Question: Write a C++ program that allows the user to enter time using hours and minutes. (NOTE: Hours are to be between 1 and 12 while
Write a C++ program that allows the user to enter time using hours and minutes. (NOTE: Hours are to be between 1 and 12 while minutes are to be between 0 and 59.) Next ask the user how much time is to be added to the original time. Then display the new time. Finally, ask the user how much time to subtract and display the final time. The program needs to have a time class that is able to add and subtract the times using overloaded + and - operators to calculate the new time when the user adds or subtracts time from the original time and get functions to retrieve the hours and the minutes. Here is how the program should work. Ask the user for the hours and for the minutes. Create an object with the hours and minutes passed to it. Then ask the user how many hours to add and how many minutes to add. Create a second object with these new values. Also, create a third object without any values passed to it. Use the overloaded + operator to add the two objects together and place the result in the third object (ie. third first + second). Next call the get functions to display the hours and the minutes in the third object. Now ask the user how much time to subtract and (after creating a fourth object with the time to be subtracted and a fifth object without any values) use the overloaded operator to subtract the time from the third object (ie. fifth third -fourth) Finally, call get functions to display the hours and the minutes in the fifth object ake sure to have your class be in a separate file from your main Pogram and you must use overloaded + and - operators in your class for adding and subtracting time. Also, turn in a UML diagram Don't forgot to document your program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
