Question: We wish to model a digital clock, which records the time as 00:00:00 to 23:59:59. The clock, which will be modelled by class DigitalClock, should

We wish to model a digital clock, which records the time as 00:00:00 to 23:59:59. The clock, which will be modelled by class DigitalClock, should have the following attributes hours (0 to 23) minutes (0 to 59) seconds (0 to 59) and the following methods DigitalClock() creates a object and sets the time to 0:0:0 void setHours( int hrs ) if hrs is not a valid value, sets the hrs to 0 void setMinutes( int min ) similar void setSeconds( int sec ) similar void tick() advances the clock one second void displayTime( ) you can use the DecimalFormat class to display the time a. Draw a UML class diagram to represent the class DigitalClock. b. Create the class DigitalClock. c. Create another class as a driver program to test it. Design your test carefully to cover as many situations as possible.

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!