Write a program that receives a number and displays dependent information based on user input. The switch statement is required, for example, 1, 2, 3, display, Monday, Tuesday, and Wednesday,
// Author: Janushu // Date: 2017/9/20/* function: write a program that can receive a number and display dependent information based on user input, the switch statement is required. For example, 1 2 3 shows Monday, Tuesday, and so on */import java. io. *; public class SwitchWeek {public static void main (String [] args) {try {// store an input number BufferedReader br = new BufferedReader (new InputStreamReader (System. in); System. out. println ("Enter the corresponding number:"); // convert the data in a row to an int num = Integer. parseInt (br. readLine (); switch (num) {case 1: System. out. println ("Monday"); break; case 2: System. out. println ("Tuesday"); break; case 3: System. out. println ("Wednesday"); break; case 4: System. out. println ("Thursday"); break; case 5: System. out. println ("Friday"); break; case 6: System. out. println ("Saturday"); break; case 7: System. out. println ("Sunday"); break; default: System. out. println ("incorrect input");} catch (Exception e) {e. printStackTrace ();}}}