Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java public class Exercise 0 7 _ StoreHours { / * Shelia's Seashell Store has a new website. Shelia wants to display if the store
java public class ExerciseStoreHours
Shelia's Seashell Store has a new website. Shelia wants to display if the store is open when someone views the website.
The following problems have you implement the logic to indicate if the store is open.
You're given an integer that represents the current hour in each problem.
The store is open if the current hour is equal to or greater than the open time and less than the closing time.
Hours are represented in hour format:
am
am
pm
pm
pm
pm
am
Shelia's Seashell Store is open between am hour and pm hour
Implement the logic to determine if the store is open based on the current hour.
Examples:
isStoreOpen true
isStoreOpen true
isStoreOpen false
isStoreOpen falsepublic boolean isStoreOpenint currentHour
return false;
Shelia forgot to take into account the day of the week.
Her store is open between am hour and pm hour on Monday day M Wednesday day W and Friday day F
Implement the logic to determine if the store is open based on the current hour and the current day.
NOTE: This problem uses a char to represent the current day of the week. You can use the following key:
Sunday U
Monday M
Tuesday T
Wednesday W
Thursday H
Friday F
Saturday S
The char for the current day is always uppercase. If an invalid char is used, return false.
Examples:
isStoreOpenM true
isStoreOpenW true
isStoreOpenS false
public boolean isStoreOpenint currentHour, char currentDay
return false;
Shelia's Seashell Store is open between am hour and pm hour on Monday day M Wednesday day W and Friday day F
In the summer, the store is open for additional hours. On Wednesday day W the store stays open until pm hour and is also
open Saturday day S from am hour to pm hour
Implement the logic to determine if the store is open based on the current hour, the current day, and if it's summer.
Examples:
isStoreOpenM true true
isStoreOpenW false true
isStoreOpenS false false
isStoreOpenS true true
public boolean isStoreOpenint currentHour, char currentDay, boolean isSummer
return false;
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