Question: java G torre New Tab Intro Wet Log o Loo Sign Safe G gem Sate Page wpid-1197731-dt-content-rid-29185991 1/courses/20SP_CPS_1231 01/lab3-2%281%29.pdf 2/2 CPS 1231 Chapter 3 lab
G torre New Tab Intro Wet Log o Loo Sign Safe G gem Sate Page wpid-1197731-dt-content-rid-29185991 1/courses/20SP_CPS_1231 01/lab3-2%281%29.pdf 2/2 CPS 1231 Chapter 3 lab 2 2. (10 points) Write a class, NumberToMonth, which does the following: a. 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 (ie numbers that are not l-12) and terminates the program using System.exit(1) if input is invalid d. Prints the name of the month: "The month is XXXXX" Tips Use a multi-way if-else statement 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) Invalid Input Enter the month of the year (number 1 to 12) The month is June Enter the month of the year (number 1 to 12) The month is December
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
