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
What do you think will happen if you use a different file format for a certain document type?
sweet-ann [11.9K]

Answer:

It will either convert the file automatically into the program so you can edit it on the different platform or it will not be able to open the document at all.

Explanation:

I have personally done this before. Usually I use Word documents, which are .doc and .docx files.

I also run a Linux based OS sometimes (dual boot) and I don't have Microsoft Office products on it. However, Linux does have their own set of products that are similar to it.

I opened a .docx file on the Linux version of Word and it did convert the file into a separate one and I was able to edit it.

However, when I then tried opening the new Linux file type on Word, it was not able to open the document at all.

Therefore, it really depends on what programs have what capabilities. Word can open .doc and .docx. Linux could open their own types as well as .doc and .docx by conversion.

A rule of thumb is just not to change the file format at all. Just stick with the original so you don't lose your file. If you cannot do so, then use a online file converter to change the file type.

3 0
3 years ago
This morning when Paul turned on his computer at work, it would not boot. Instead, Paul reported that he heard a loud clicking n
IRISSAK [1]

Answer:

The problem with Paul's computer is that the magnetic hard drive failed.

Explanation:

A magnetic hard drive or hard disk is a non-volatile storage device, which is used to store different information on a computer.

The magnetic disk is made up of numerous magnetic plates, these plates are divided into sectors and tracks. A spindle is present in the middle to rotate the combined plates or the whole unit.

When there is a clicking noise coming from the magnetic disk, it could mean that one of the plates is damaged or if the power to the computer is inconsistent. This can greatly affect the performance of your computer.

3 0
4 years ago
________an approach to database and software development that emphasizes "individuals and interactions over processes and tools,
dimulka [17.4K]

Answer:

Agile software development

Explanation:

Agile software development  model is a blend of iterative and steady procedure models with center around process flexibility and consumer loyalty by fast conveyance of working programming item. Nimble Methods break the item into little gradual forms. These assembles are given in emphases.

So in blank space there will be Agile software development

7 0
3 years ago
T-1 is the simplest WAN data service provided by telecom carriers. It has a data rate of
-Dominant- [34]
1.544Mb/s  (megabits per second)
6 0
3 years ago
Which of the following is true of Chinese Opera: Two opera centers emerged Beijing and Yangzhou 300-400 forms of opera arose in
zhuklara [117]

Answer:

d. Peking opera was a fusion of ancient and modern opera forms

Explanation:

The dramatic art form known as Beijing opera—or Peking opera—has been a staple of Chinese entertainment for more than two centuries. It was founded in 1790 when the "Four Great Anhui Troupes" went to Beijing to perform for the Imperial Court.

Some 40 years later, well-known opera troupes from Hubei joined the Anhui performers, melding their regional styles. Both the Hubei and Anhui opera troupes used two primary melodies adapted from the Shanxi musical tradition: "Xipi" and "Erhuang." From this amalgam of local styles, the new Peking or Beijing opera developed.

Reference: Szczepanski, Kallie. “A Brief History of Chinese Opera.” ThoughtCo, ThoughtCo, 6 Feb. 2019

7 0
4 years ago
Other questions:
  • A(n) combines video instruction and interaction with an instructor and students in an online classroom.
    9·1 answer
  • Which is the output of the formula =AND(12&gt;6;6&gt;3;3&gt;9)
    6·1 answer
  • How can my computer catch a virus?
    13·1 answer
  • Having plug and play support means you can plug in a device, turn on the computer, and then immediately begin using the device t
    11·1 answer
  • IBF Consultants, LLC provides consulting services in privacy and theft deterrence solutions. Another client has very sensitive d
    7·1 answer
  • 5.) Spam messages account for what percentage of all email?
    15·2 answers
  • Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a n
    10·1 answer
  • Discuss the causes ,symptoms, preventive measures and treatment of AIDS​
    6·2 answers
  • What are the benefits of computer literacy?
    10·1 answer
  • Capstone Project part 11 quiz
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!