Question: Write a Java class Clock for dealing with the day time represented by hours, minutes, and seconds. Your class must have the following features: i.

Write a Java class Clock for dealing with the day time represented by hours, minutes, and seconds. Your class must have the following features:

i. Three instance variables for the hours, minutes, and seconds. (2 marks)

ii. Write default constructors for class Clock. (1 marks)

iii. Write a constructor with three parameters: hours, minutes, and seconds. This constructor will get hour, minutes and second passed by main class. (6 marks)

iv. Create an object to call default constructor and constructor with value as below: Hour = 3 Minutes = 40 Second = 20 (4 marks)

(b) Based on question (a), explain benefit of using these OOP concept in your work.

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!