Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

Students also viewed these Databases questions

Question

=+employee to take on the international assignment?

Answered: 1 week ago

Question

=+differences in home- and host-country costs of living?

Answered: 1 week ago