Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java please a. Using UML notation, design a class called MyTime in Microsoft Word to represent an instance of time. The class contains: a.

In java please

image text in transcribedimage text in transcribedimage text in transcribed

a. Using UML notation, design a class called MyTime in Microsoft Word to represent an instance of time. The class contains: a. Data fields hour, minute and second to represent time. b. A no-arg constructor to create a Time object with values of current time. c. A constructor to construct a Time object with specified values for hour, minute and second. d. A constructor to construct a Time object with specified elapsed time since midnight January 11970 in milliseconds. The values of the data fields will represent this time. e. Three getter methods for the data fields. f. A method called setTime(long elapsedTime) that sets a new time for the object using elapsed time. Here is code for the constructor in part (d) public MyTime (long elapsedTime) \{ setTime (elapsedTime); f And here is code for the setTime() method public void setTime(long elapsedTime) \{ // Obtain the total seconds since the midnight, Jan 1,1970 long totalseconds = elapsedTime / 1000 ; // Compute the current second in the minute in the hour c. Write a test program that will: - Create three MyTime objects as shown below. - After creating each MyTime object, display the time in format Hour:minute:second MyTime time1 = new MyTime () / /display timel MyTime time2 = new MyTime (555550000); / /display timel MyTime time3 = new MyTime (5,23,55); / /display time1

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

what is Digital Forensic Tools

Answered: 1 week ago

Question

Define Decision making

Answered: 1 week ago

Question

What are the major social responsibilities of business managers ?

Answered: 1 week ago

Question

What are the skills of management ?

Answered: 1 week ago

Question

Identify the different methods employed in the selection process.

Answered: 1 week ago

Question

Demonstrate the difference between ability and personality tests.

Answered: 1 week ago