desislava_topuzakova

07. Working Hours

Sep 25th, 2021
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. package Conditional_Statements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class WorkingHours_01 {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int hours = Integer.parseInt(scanner .nextLine());
  10. String day = scanner .nextLine();
  11.  
  12. String workingTimes= "";
  13.  
  14. switch (day) {
  15. case "Monday":
  16. case "Tuesday":
  17. case "Wednesday":
  18. case "Thursday":
  19. case "Friday":
  20. case "Saturday":
  21. if (hours >= 10 && hours <= 18) {
  22. workingTimes = "open";
  23. } else {
  24. workingTimes = "closed";
  25. }
  26. break;
  27. default:
  28. workingTimes = "closed";
  29. break;
  30. }
  31. System.out.println(workingTimes);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment