Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
TimeTest.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
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