Question: 9 . Replace / / Your code here with your answer. a ) This following one should be done with if statements. Your code should

9. Replace // Your code here with your answer.
a) This following one should be done with if statements. Your code should read an integer from the command prompt / terminal. If the number is 0, your code should print Sunday; if its 1, your code should print Monday; if its 2, it should print Tuesday, etc. If the number the user inputs is not within the range [0,6], your code should print Invalid number.
Scanner input = new Scanner(System.in);
int x = input.nextInt();
// Your code here
b) This following one should be done with switch cases. Your code should read an integer from the command prompt / terminal. If the number is 1, your code should print January; if its 2, your code should print February; if its 3, it should print March, etc. If the number the user inputs is not within the range [1,12], your code should print Invalid Number.
Scanner input = new Scanner(System.in);
int x = input.nextInt();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!