Question
Reimplement the Ti meOfDay class of Exercise 3.10 by using a different internal representation: the number of seconds since midnight. Exercise 3.10 Implement a class
Reimplement the Ti meOfDay class of Exercise 3.10 by using a different internal representation: the number of seconds since midnight.
Exercise 3.10
Implement a class Ti meOfDay that stores a time between 00:00:00 and 23:59:59. Supply a constructor Ti meOfDay (i nt hours , i nt mi nutes , i nt seconds) and accessor methods to get the current hours, minutes, and seconds. Supply methods
Ti meOfDay addSeconds (i nt seconds)
i nt secondsFrom (Ti meOfDay other)
The first method returns a Ti meOfDay object that is the given number of seconds away from the current object. The second method computes the number of seconds between two Ti meOfDay objects. Use three integers for the hours, minutes, and seconds as the internal representation
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started