Write the following c++ program that has separate int member data for hours, minutes, and seconds. One constructor should initialize this data to 0, and another constructor should initialize it to fixed values. Make void print() to display time in 23:59:59 format. Make void setTime(int,int,int) to set hour, minute, second. include a tick() member function that increments the time stored in a Time object by one second. Make an add member function that should add two objects of type time passed as arguments. Be sure to test the following cases: 1.Incrementing into the next minute. 2.Incrementing into the next hour. 3.Incrementing into the next day (i.e., 23:59:59 to 00:00:00). Make 1000 times loop in a main function. Call tick and print functions in that loop for an object. Also make two objects and add them to a third object and print their values.
Write the following c++ program
that has separate int member data for hours, minutes, and seconds.
One constructor should initialize this data to 0, and another constructor should initialize it to fixed values.
Make void print() to display time in 23:59:59 format.
Make void setTime(int,int,int) to set hour, minute, second.
include a tick() member function that increments the time stored in a Time object by one second.
Make an add member function that should add two objects of type time passed as arguments.
Be sure to test the following cases:
1.Incrementing into the next minute.
2.Incrementing into the next hour.
3.Incrementing into the next day (i.e., 23:59:59 to 00:00:00).
Make 1000 times loop in a main function. Call tick and print functions in that loop for an object. Also make two objects and add them to a third object and print their values.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images