Convert the following switch statement to an if-else block. • The output must be the same for all cases. • Assume the switch variable is already declared and initialized. • Some lines may be used...


Please change this to an Else-If block (Java). thank you!


1-20


Convert the following switch statement to an if-else block.<br>• The output must be the same for all cases.<br>• Assume the switch variable is already declared and initialized.<br>• Some lines may be used once, never, or multiple times.<br>• Note that some lines may need to be blank. If that is the case, the blank line MUST<br>BE THE LAST LINE in the block.<br>For example (follow this format):<br>if (a == 10) {<br>sum += 10;<br>//LEAVE BLANK<br>}<br>Instead of (do NOT do this):<br>if (a == 10) {<br>//LEAVE BLANK<br>sum += 10;<br>}<br>switch (theOffice) {<br>case 1:<br>System.out.println(

Extracted text: Convert the following switch statement to an if-else block. • The output must be the same for all cases. • Assume the switch variable is already declared and initialized. • Some lines may be used once, never, or multiple times. • Note that some lines may need to be blank. If that is the case, the blank line MUST BE THE LAST LINE in the block. For example (follow this format): if (a == 10) { sum += 10; //LEAVE BLANK } Instead of (do NOT do this): if (a == 10) { //LEAVE BLANK sum += 10; } switch (theOffice) { case 1: System.out.println("Jim: tuna"); case 2: System.out.println("Michael: world's greatest boss"); break; default: System.out.println("nae"); case 3: System.out.println("Dwight: assistant regional manager");
if (1..<br>_) {<br>2.<br>3.<br>} else if (4.<br>_) {<br>System.out.println(
> > 2. 4. "/>
Extracted text: if (1.. _) { 2. 3. } else if (4. _) { System.out.println("Michael: world's greatest boss"); } else if (5. _) { System.out.println("Dwight: assistant regional manager"); } else { 6. 7. } 1. theOffice == 1 System.out.println("Jim: tuna" v 3. break theOffice == > > > 2. 4.

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here