Suppose that the int variable hour contains the hour of the day in 24-hour notation. That is, it contains an integer that ranges from 0 to 23, where 0 is midnight. Write an if statement that displays a message for a café indicating the current meal offered. Use the following schedule:
Breakfast is served from 6 a.m. to 10 a.m.
Lunch is served from 11 a.m. to 2 p.m.
Dinner is served from 5 p.m. to 8 p.m.
The café is closed at all other times.
a. What valid data types can be used with a switch statement?
b. In a switch statement, is it a syntax error if the keyword break is not used after processing a case?
c. Is it possible to use a switch statement to solve the earthquake problem given? Why or why not
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here