1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
shepuryov [24]
3 years ago
13

Rewrite this if/else if code segment into a switch statement int num = 0; int a = 10, b = 20, c = 20, d = 30, x = 40; if (num &g

t; 101 && num <= 105) { a += 1; } else if (num == 208) { b += 1; x = 8; } else if (num > 208 && num < 210) { c = c * 3; } else { d += 1004; }
Computers and Technology
1 answer:
Tanya [424]3 years ago
3 0

Answer:

public class SwitchCase {

   public static void main(String[] args) {

       int num = 0;

       int a = 10, b = 20, c = 20, d = 30, x = 40;

       switch (num){

           case 102: a += 1;

           case 103: a += 1;

           case 104: a += 1;

           case 105: a += 1;

           break;

           case 208: b += 1; x = 8;

           break;

           case 209: c = c * 3;

           case 210: c = c * 3;

           break;

           default: d += 1004;

       }

   }

}

Explanation:

  • Given above is the equivalent code using Switch case in Java
  • The switch case test multiple levels of conditions and can easily replace the uses of several if....elseif.....else statements.
  • When using a switch, each condition is treated as a separate case followed by a full colon and the the statement to execute if the case is true.
  • The default statement handles the final else when all the other coditions are false
You might be interested in
____ that allow individuals to perform specific tasks are launched via the operating system, such as by using the windows start
schepotkina [342]
Programs that allow individuals to perform specific tasks are launched via the operating system, such as by using the windows start menu on windows computers. Programm is a set of instructions written for a computer.<span>The Start menu contains icons for all installed programs and data collections, usually for programs.</span>
3 0
3 years ago
Please Help! I will give a Brainliest to anyone who answers with the right answer! Please and Thank You! What view is most often
Nata [24]

Answer:

form is used ethier to display or enter data in access 2016

8 0
3 years ago
When you use an IDE instead of a simple text editor to develop a program, ____________.
nalin [4]

Answer:

your answer is :

some help is provided

Explanation:

An integrated developed environment (IDE) provide more programming help than a plain text editor.

please mark me brainlist

4 0
3 years ago
As you draw a star, pressing the shift key while you drag increases the number of points on the star. True or false
stepan [7]

Answer:

true

Explanation:

3 0
3 years ago
Clive wants to print the numbers 1 through 10, so he uses the following code.
snow_tiger [21]

If Clive wants to print the numbers 1 through 10 with the code:

for x in range(10):

    print (x)

He will not get the output he wants because python begins counting at 0, so the numbers 0 through 9 will print.

<h3>Code explanation</h3>

The code is represented in python.

  • We loop through the number in the range 10.
  • Then print the the looped numbers.

Generally, python begins counting from 0. Therefore, the numbers that will be printed are as follows:

  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

learn more on python here: brainly.com/question/26104476?referrer=searchResults

8 0
3 years ago
Other questions:
  • What is the result of segmenting a network with a bridge (switch)? (Choose two)
    14·1 answer
  • What can you search on Microsoft Word or Powerpoint Clipart or Google (Clip art) to find more pictures like the ones below but w
    7·1 answer
  • Kevin has to decide on a financial service provider that will help him with his needs related to tax exemptions and payments. He
    10·1 answer
  • Hello my friends i am trying to reboot my i phone 4 but i could not i tried many ways can u help me
    14·1 answer
  • If a*b = 2a - 56, calculate the value of<br>3 * 4​
    14·1 answer
  • You need to design a backup strategy. You need to ensure that all servers are backed up every Friday night and a complete copy o
    6·1 answer
  • In Excel you insert a comment in a worksheet by using the ____ tab on the Ribbon.
    10·1 answer
  • Given a string on one line and an integer index on a second line, output the character of the string at that index.
    12·1 answer
  • enter formula that uses the IF function to test whether the number of years of experience (cell M5) is greater than or equal to
    9·1 answer
  • What type of security solution provides a hardware platform for the storage and management of encryption keys?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!