Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Conditional_Statements;
- import java.util.Scanner;
- public class WorkingHours_01 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int hours = Integer.parseInt(scanner .nextLine());
- String day = scanner .nextLine();
- String workingTimes= "";
- switch (day) {
- case "Monday":
- case "Tuesday":
- case "Wednesday":
- case "Thursday":
- case "Friday":
- case "Saturday":
- if (hours >= 10 && hours <= 18) {
- workingTimes = "open";
- } else {
- workingTimes = "closed";
- }
- break;
- default:
- workingTimes = "closed";
- break;
- }
- System.out.println(workingTimes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment