Question: Create a new instance variable called totalSeconds to keep track of the total number of seconds from midnight. o Now start converting the getters and

Create a new instance variable called totalSeconds to keep track of the total
number of seconds from midnight.
o Now start converting the getters and setters starting with getHour() and setHour().
Since you need getHour() to complete setHour() start with getHour(). getHour()
just returns totalSeconds /60/60. setHour() subtracts out the current value for
the hour and then adds the new value. setHour() looks like the following:
o You should now be able to delete the instance variable hour and when you run
Time2Test.java the output should be exactly the same as it was before you made
the changes to getHour() and setHour().
o Now do the same thing to getMinute() and setMinute() coming up with the correct
formulas to work with minutes instead of hours. Then delete the instance variable
minute.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!