Question: Question 4 Write a Java class Clock for dealing with the day time represented by hours, minutes, and seconds and explain the benefit using OOP

Question 4

Write a Java class Clock for dealing with the day time represented by hours, minutes, and seconds and explain the benefit using OOP concept in the work. The class must have the following features:

i. Three instance variables for the hours, minutes, and seconds

ii. Write default constructors for class Clock.

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

iv. Create an object to call default constructor and constructor with value as below:

Hour = 3

Minutes = 40

Second = 20

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!