In: Computer Science
Enter a number (0-6): 2
** 2 is Tue **
!!! NO if-else conditions
import java.util.Scanner; public class WeekDays { public static void main(String[] args) { int n; Scanner scan = new Scanner(System.in); System.out.print("Enter a number (0-6): "); n = scan.nextInt(); switch (n){ case 0: System.out.println("** 0 is Sum **"); break; case 1: System.out.println("** 1 is Mon **"); break; case 2: System.out.println("** 2 is Tue **"); break; case 3: System.out.println("** 3 is Wed **"); break; case 4: System.out.println("** 4 is Thur **"); break; case 5: System.out.println("** 5 is Fri **"); break; case 6: System.out.println("** 6 is Sat **"); break; default: System.out.println("Invalid input"); } } }