Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 01.05.2021
- import java.util.Scanner;
- public class Ex05 {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int d;
- String day;
- // input data from user
- System.out.print("Enter day number ");
- d = in.nextInt();
- /*
- * if (d == 1) { day = "Synday"; } else if (d == 2) { day = "Monday"; } else if
- * (d == 3) { day = "Tuesday"; } . . .
- */
- switch (d) {
- case 1:
- day = "sunday";
- break;
- case 2:
- day = "monday";
- break;
- case 3:
- day = "Tuesday";
- break;
- case 4:
- day = "Wednesday";
- break;
- case 5:
- day = "Thursday";
- break;
- case 6:
- day = "friday";
- break;
- default:
- day = "saturday";
- break;
- }
- System.out.println(day);
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement