Ask the user to enter the month of the year (number 1 through 12): “Enter the month of the year - number 1 to 12” b. Get the month using a Scanner c. checks for invalid input (i.e. numbers that are...


Ask the user to enter the month of the year (number 1 through 12): “Enter the month of the year - number 1 to 12”
b. Get the month using a Scanner
c. checks for invalid input (i.e. numbers that are not 1 – 12) and terminates the program
using System.exit(1)if input is invalid
d. Prints the name of the month: “The month is XXXXX”
Now, this time, write a class, NumberToMonthUsingSwitch, that does the same but uses the switch statement.
Tips
 Use the switch statement along with case and break
 Use the System.exit(1) in the default to terminate the program
Submission
 Copy and paste your code
 Screen shot the console with user input of three example months (one invalid input, two any
month)
Sample Run
Enter the month of the year - number 1 to 12
77
Invalid Input
Enter the month of the year - number 1 to 12
2
The month is February
Enter the month of the year - number 1 to 12
10
The month is October



Jun 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here