(The Time class) Design a class named Time. The class contains: 1 The data fields hour, minute, and second that represent a time. I A no-arg constructor that creates a Time object for the current time. (The values of the data fields will represent the current time.)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Hello, I don’t understand this Java Question may someone help me out, may you also submit the completed code typed out the code in text form please instead of a screenshot of a screenshot ?
*10.1 (The Time class) Design a class named Time. The class contains:
1 The data fields hour, minute, and second that represent a time.
I A no-arg constructor that creates a Time object for the current time. (The
values of the data fields will represent the current time.)
10.indd 401
er 10 Object-Oriented Thinking
I A constructor that constructs a Time object with a specified elapsed time
since midnight, January 1, 1970, in milliseconds. (The values of the data
fields will represent this time.)
A constructor that constructs a Time object with the specified hour, minute,
and second.
1 Three getter methods for the data fields hour, minute, and second,
respectively.
I A method named setTime (long elapseTime) that sets a new time for the
object using the elapsed time. For example, if the elapsed time is 555550000
milliseconds, the hour is 10, the minute is 19, and the second is 10.
Draw the UML diagram for the class then implement the class. Write a
test program that creates three Time objects (using new Time (), new
Time (555550000), and new Time (5, 23, 55)) and displays their hour,
minute, and second in the format hour:minute:second.
(Hint: The first two constructors will extract the hour, minute, and second
from the elapsed time. For the no-arg constructor, the current time can be
obtained using System.currentTimeMillis (), as shown in Listing 2.7,
ShowCurrentTime.java. Assume the time is in GMT.)
Transcribed Image Text:*10.1 (The Time class) Design a class named Time. The class contains: 1 The data fields hour, minute, and second that represent a time. I A no-arg constructor that creates a Time object for the current time. (The values of the data fields will represent the current time.) 10.indd 401 er 10 Object-Oriented Thinking I A constructor that constructs a Time object with a specified elapsed time since midnight, January 1, 1970, in milliseconds. (The values of the data fields will represent this time.) A constructor that constructs a Time object with the specified hour, minute, and second. 1 Three getter methods for the data fields hour, minute, and second, respectively. I A method named setTime (long elapseTime) that sets a new time for the object using the elapsed time. For example, if the elapsed time is 555550000 milliseconds, the hour is 10, the minute is 19, and the second is 10. Draw the UML diagram for the class then implement the class. Write a test program that creates three Time objects (using new Time (), new Time (555550000), and new Time (5, 23, 55)) and displays their hour, minute, and second in the format hour:minute:second. (Hint: The first two constructors will extract the hour, minute, and second from the elapsed time. For the no-arg constructor, the current time can be obtained using System.currentTimeMillis (), as shown in Listing 2.7, ShowCurrentTime.java. Assume the time is in GMT.)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY