Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started