Question: Instructions: Code a do - while loop that prints the monthName from October through December or it issues a Month not found! error message based

Instructions:
Code a do-while loop that prints the monthName from October through December or it issues a "Month not found!" error message based on the value of a loop-control variable called month that has been declared and initialized to 1. Assume monthName has already been declared and initialized. The loop needs to execute to print the error message 9 times and the name of the months from October through December. Watch your spacing: double-space after colons, no spaces after headers, the semicolon for a Java statement or a brace, no spaces before or after the parentheses of a test expression or method call.
Use a switch statement that evaluates the month. The switch includes a default (no break statement after the default). No need to code for the months preceding October. Code the Java statement for the case/default on the same line as the case. Each case statement assigns the month's literal value or the error message to monthName.
Use a post-increment.
Use printf() with format specifiers (one line advance at the beginning). There is only ONE printf() statement.
No need to comment end braces.
****EC DoWhileSwitch SAMPLE OUTPUT****
Month not found!
Month not found!
Month not found!
Month not found!
Month not found!
Month not found!
Month not found!
Month not found!
Month not found!
October
November
December
//Begin repetition.
//Begin repetition scope.
//switch and its expression.
//Begin switch scope.
//1st match and its statement.
//Statement to exit switch.
//2nd match and its statement.
//Statement to exit switch.
//3rd match and its statement.
//Statement to exit switch.
//Catches everything else and its statement.
//End switch scope.
//Alter loop-control variable.
//Print.
//END repetition scope with test expression.

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 Programming Questions!