Advertisement
kaloyan99

Untitled

Mar 2nd, 2021
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. Scanner scanner = new Scanner(System.in);
  2.  
  3. String hour = scanner.next();
  4. String time = scanner.next();
  5.  
  6. if ((time.equals("PM") && hour.charAt(0) >= '1')) {
  7. if (hour.charAt(0) == '1' && hour.charAt(1) == '2') {
  8. System.out.println("non-beer time");
  9. } else System.out.println("beer time");
  10. } else if (time.equals("AM") && hour.charAt(0) == '0' && hour.charAt(1) < '3' || hour.charAt(0) < '3' && hour.charAt(1) == ':') {
  11. System.out.println("beer time");
  12. } else System.out.println("non-beer time");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement