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
What names of websites of presentation or visualization <br>​
Fittoniya [83]

Explanation:

Google Slides. Google has made a conscious effort to emulate many of MS Office's tools, and Slides is their alternative to PowerPoint. ...

DesignBold. ...

PowToon. ...

Slides. ...

ClearSlide. ...

Moovly. ...

Prezi. ...

KnowledgeVision.

5 0
3 years ago
Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, ________ element(s) mus
Klio2033 [76]

Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, 20,000 element(s) must be compared.

6 0
2 years ago
Which of the following systems is designed with full-time monitoring tools that search for patterns in network traffic to identi
kvasek [131]

Answer:

B. Intrusion Detection Software (IDS)

Explanation:

An Intrusion Detection Software (IDS) is designed to monitor all inbound and outbound network activity and identify any suspicious patterns that may indicate a network or system attack from someone attempting to break into or compromise a system. IDS is considered to be a passive-monitoring system, since the main function of an IDS  product is to warn you of suspicious activity taking place − not prevent them. An IDS essentially reviews your network traffic and data and will identify probes, attacks, exploits and other vulnerabilities. IDSs can respond to the suspicious event in one of several ways, which includes displaying an alert, logging the event or even paging an administrator. In some cases the IDS may be prompted to reconfigure the network to reduce the effects of the suspicious intrusion.

3 0
3 years ago
Which TWO of these correctly describe a Trojan horse malware?
mina [271]
The first one and last one
6 0
2 years ago
Read 2 more answers
How to make a water bottle rocket??
k0ka [10]
This question should be in physics so this is my answer in C&T format-go to a online shop and order one or the pieces then follow the instructions that will be given.
6 0
3 years ago
Other questions:
  • How does the team know what to work upon during the iteration
    6·1 answer
  • Chloe is building a kiosk-based Excel application. She wants to make some modifications to the screen elements in order to keep
    8·1 answer
  • TRUE OR FALSE, databases allow you to search for content on the internet based on certain criteria (PLS ANSWER RIGHT)
    10·2 answers
  • The process of encoding messages or information in such a way that only authorized parties can read it is called ____________.
    7·1 answer
  • What are three requirements of information technology a. Accuracyb. _______________________________c. __________________________
    13·1 answer
  • Write a line of code to convert time to hours. Remember there are 60 minutes in an hour. Then write a line of code to calculate
    9·2 answers
  • Evolucion de los sistemas operativos
    5·1 answer
  • George works for a print newspaper in which of these areas would you be interested to hire new recruits for the newspaper WHICH
    11·1 answer
  • When planning your App what difficulties did come across and why?
    5·2 answers
  • Jazmine just finished setting up an operating system that's designed to work between a VM guest OS and computer hardware. What i
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!