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 dowhile loop that prints the monthName from October through December or it issues a "Month not found!" error message based on the value of a loopcontrol variable called month that has been declared and initialized to Assume monthName has already been declared and initialized. The loop needs to execute to print the error message times and the name of the months from October through December. Watch your spacing: doublespace 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 casedefault on the same line as the case. Each case statement assigns the month's literal value or the error message to monthName.
Use a postincrement.
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.
st match and its statement.
Statement to exit switch.
nd match and its statement.
Statement to exit switch.
rd match and its statement.
Statement to exit switch.
Catches everything else and its statement.
End switch scope.
Alter loopcontrol 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
