Question: . Task: Create a Time class. The class should contain 3 fields (integers called hrs, mins, secs, for hours, minutes and seconds) and the following

. Task: Create a Time class. The class should contain 3 fields (integers called hrs, mins, secs, for hours, minutes and seconds) and the following methods:

Default and alternate constructors.

Three getters (accessors) to return hours, minutes and seconds

A method named set; invalid values set to 0

Two methods named printMilitary and printStandard to print each Time object in military and standard format

A method toString()

A method named equals to compare 2 Time objects for equality

2 methods named copy and getCopy to make a copy of a Time object into another Time object

A method named advanceSecs to advance time by 1 second

A method named lessThan to decide if a time comes before another time

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!