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]
2 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]2 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
Gps has fostered many benefits in our society, but have also added some risks. What is a risk of gps?
kozerog [31]

GPS is a global positioning system that tells direction and routes. Some risks that come along with GPS are inaccuracy, distraction, and lack of knowledge.

<h3>What is GPS?</h3>

GPS is a radio navigation system based on the satellite and is used to navigate the directions with the help of the signals. Though it has many benefits also has disadvantages. It sometimes does not show accurate routes and direction that is too long.

The navigation system causes distraction during driving and may cause an accident. Too much reliance on GPS causes a lack of knowledge in remembering the directions and places. It may sometimes lead to crime as the saved information and be leaked.

Therefore, GPS has advantages and disadvantages too.

Learn more about GPS here:

brainly.com/question/6905079

#SPJ4

5 0
2 years ago
Research different ways that 3D printing is used in society. Tell us about the items that are 3D printed.
Eva8 [605]

3D printing helps to reduce the time it takes for a manufacturer to create the product. This lets manufacturers invest their time to make flawless products because the production cycle time is reduced.

3 0
3 years ago
Read 2 more answers
What is the output for the following program?
Lelu [443]

Answer:

Output:

15

20

25

Explanation:

In first iteration value of num is 10. Condition is checked 10 is less than 21 so value of num is incremented by 5 and value 15 is printed than again condition is checked 15<21 so value of num is incremented again and 20 is printed. Again condition is checked 20<21. So 25 is printed. Then 4th time when condition is checked vakue of num is 25 and while loop condition becomes false because 25 is not less than 21 and program is terminated here.

6 0
2 years ago
For the block of 400 addresses, what is the length of the net id? njit
rewona [7]
23 bits would leave room for 512 node numbers.
3 0
3 years ago
Who invented Computer? Answer Differently​
FinnZ [79.3K]

Answer:

Charles Babbage, an English mechanical engineer and polymath, originated the concept of a programmable computer. He is considered the "father of the computer". He invented the first mechanical computer in the early 19th century.

Explanation:

plz make me as a brainliest frd

8 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following scenarios can best be addressed by operations management?
    11·1 answer
  • Convert the binary number into a hexadecimal number.
    7·1 answer
  • You are a computer consultant called in to a manufacturing plant. The plant engineer needs a system to control their assembly li
    10·1 answer
  • What is the best stratiget to avoid paying intrest in your credit cared
    13·1 answer
  • how do I delete my brainly account, my child signed up for it and nothing has been paid but I do not want the account to exist a
    7·2 answers
  • (25 POINTS)Which statement best reflects the importance of following safety guidelines?
    8·2 answers
  • Mrs. Schlair has an annual salary of $96,402.<br> a. What would her semimonthly salary be?
    9·1 answer
  • PYTHON
    5·1 answer
  • How to create create a database in mysql using clv files
    11·1 answer
  • Which option identifies the programming paradigm selected in thr following scenario? A student is writing a science fiction stor
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!