Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java class to implement the following: Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if

Write a Java class to implement the following: Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are on vacation, set an int variable indicating when the alarm clock should ring.

Weekdays, the alarm should be set to 7 and on the weekend it should be 10

Unless we are on vacation: then on weekdays it should be 10 and weekends it should be 0.

Display a short message informing the user about the purpose of this class.

Provide appropriate instructions to the user for input values

Display the output in descriptive sentence that includes what time the alarm has been set.

If the int variable is set to zero, display "The alarm is off"

Example:

Input:

Day: 3

Vacation: false

Output:

The alarm is set for 7 am.

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

3-13 Analyze Amazon.com and Walmart using the

Answered: 1 week ago

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago