Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.1 2. Writing Another Class That Uses ielseStatements In this task, you write a class called Clock that uses if/else statements to display the part

image text in transcribed
1.1 2. Writing Another Class That Uses ielseStatements In this task, you write a class called "Clock" that uses if/else statements to display the part of day depending upon the time of day Use the following table as a guideline. Time of Day Part of Day 8.01 to 12:00 Morning 12 01 to 17.00 Aftemoon 1701 to 24.00 Evening 0:01 to 8:00 Early Morning 1 11 111 Create a new Java class called "Clock" that contains an intfield called current Time Initialize this field to hold the hour of the day. (Example 400 - 04:00, 1505 = 15.05) In the Clock class, create a displayPartOfDaymethod Display the part of the day associated with the value of the curent Tumefield. For example, if the current Time field equals 2100 you would display "Evening" You need not check for values outside the range of 1 to 2400 Note: Hint is given in the course material Save, couple, and execute your program by running the ClockTest class(Create, compile and run this controlling class) Repeat Step 3 several times by assigning different values to the currentTime member vanable Note: A leading zero indicates an octal value. Therefore, the program does not compile if you set current Time to 0800. You need to specify current time as 800 for 8:00 AM to successfully compile the prograin Please solve with Java 1V

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 Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago