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
galina1969 [7]
3 years ago
11

The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values and goes from a force of 0,

which is no wind, up to 12, which is a hurricane. The following script first generates a random force value. Then, it prints a message regarding what type of wind that force represents, using a switch statement. If random number generated is 0, then print "there is no wind", if 1 to 6 then print "this is a breeze", if 7 to 9 "this is a gale", if 10 to 11 print "this is a storm", if 12 print "this is a hurricane!". (Hint: use range or multiple values in case statements like case {1,2,3,4,5,6})
Required:
Re-write this switch statement as one nested if-else statement that accomplishes exactly the same thing. You may use else and/or elseif clauses.

ranforce = randi([0, 12]);
switch ranforce
case 0
disp('There is no wind')
case {1,2,3,4,5,6}
disp('There is a breeze')
case {7,8,9}
disp('This is a gale')
case {10,11}
disp('It is a storm')
case 12
disp('Hello, Hurricane!')
end
Computers and Technology
1 answer:
joja [24]3 years ago
4 0

Answer:

The equivalent if statements is:

ranforce = randi([0, 12]);

if (ranforce == 0)

     disp('There is no wind')

else  if(ranforce>0 && ranforce <7)

     disp('There is a breeze')

else  if(ranforce>6 && ranforce <10)

     disp('This is a gale')

else  if(ranforce>9 && ranforce <12)

     disp('It is a storm')

else  if(ranforce==12)

     disp('Hello, Hurricane!')

end

Explanation:

<em>The solution is straight forward.</em>

<em>All you need to do is to replace the case statements with corresponding if or else if statements as shown in the answer section</em>

You might be interested in
Television, radio, newspapers, magazines, the Internet, and other forms of communication are collectively referred to as thea. W
quester [9]

Answer:  c) Mass media.

Explanation:

Mass media is the technological media platform which imparts information in different forms to the public and audience.It reaches audience through devices and content that can be in written format, spoken,broadcasting etc.

  • Sources of mass media to impart information can be television, internet, radio, newspaper , magazine etc.
  • Other options are incorrect because high-tech politics is political field with impact of technology.World Wide Web(www) is constituted of resource and internet facility.
  • Government's fourth branch is the unofficial cluster of institution impacting three official branches.Media conglomeration is the firm that on various mass media companies.
  • Thus, the correct option is option(c).
6 0
3 years ago
Which statements are true about mysql workbench? (choose three)
nika2105 [10]

Answer:

Many things are true about it

3 0
3 years ago
Given the declaration
STALIN [3.7K]

Answer:

False

Explanation:

There's only one component of the array list which is list[0] which has value 50

7 0
4 years ago
A __________ is more concerned with copying and running code, rather than the code's maintainability or documentation.
gladu [14]

Answer: system architect

Explanation:

A system architect is more concerned with copying and running code, rather than the code's maintainability or documentation

3 0
2 years ago
The term “digital divide” refers to the gap between
juin [17]
It is the gap between demographics and regions.
4 0
4 years ago
Other questions:
  • python Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that ho
    10·1 answer
  • What does a first line indent look like
    13·1 answer
  • Like this post if u hate edhesive
    6·1 answer
  • 642<br> +277<br> What does 642+277
    7·1 answer
  • I need help please <br> just plug in the words with their definitions.......
    10·2 answers
  • Which of the following Web sites would be MOST credible?
    6·1 answer
  • Which of the follow efficiencies would be considered unreasonable?
    13·1 answer
  • Spam is _____.
    8·1 answer
  • I will give brainyest
    13·2 answers
  • The electors in each state shall have the qualifications requisite for electors of the most numerous branch of the state legisla
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!