Answered step by step
Verified Expert Solution
Link Copied!

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 /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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

Identify the nine clusters in the analytics ecosystem.

Answered: 1 week ago