desislava_topuzakova

01. Day of Week

Apr 17th, 2021
582
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int number = Integer.parseInt(scanner.nextLine());
  7.         //1 -> Monday
  8.         //2 -> Tuesday
  9.         //3 -> Wednesday
  10.         //4 -> Thursday
  11.         //5 -> Friday
  12.         //6 -> Saturday
  13.         //7 -> Sunday
  14.         // -> Error
  15.         switch (number) {
  16.             case 1:
  17.                 System.out.println("Monday");
  18.                 break;
  19.             case 2:
  20.                 System.out.println("Tuesday");
  21.                 break;
  22.             case 3:
  23.                 System.out.println("Wednesday");
  24.                 break;
  25.             case 4:
  26.                 System.out.println("Thursday");
  27.                 break;
  28.             case 5:
  29.                 System.out.println("Friday");
  30.                 break;
  31.             case 6:
  32.                 System.out.println("Saturday");
  33.                 break;
  34.             case 7:
  35.                 System.out.println("Sunday");
  36.                 break;
  37.             default:
  38.                 System.out.println("Error");
  39.                 break;
  40.         }
  41.     }
  42. }
  43.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×