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
irina1246 [14]
3 years ago
10

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. Write a script that generates a random force value between 0 and 12, with use of randi command, Then, it prints a message regarding what type of wind that force represents. The answers should follow this pattern:
Computers and Technology
1 answer:
yaroslaw [1]3 years ago
8 0

Answer:

See explaination

Explanation:

Script by switch statement

random_force = randi(12) switch(random_force) case 0 disp("There is no wind") case {1,2,3,4,5,6} disp("there is a breeze") case {7,8,9} disp("there is a gale") case {10,11} disp("it is a storm") case 12 disp("Hello Hurricane!") end

First it generates a random force between 1 and 12

Then the switch statement is executed according to the force

in case values of corresponding force are written and their string will be printed according to the case which depends upon the value of random_force

Multiple case values are used because we need multiple values to print the same string

So values {1,2,3,4,5,6} , {7,8,9},{10,11} are combined into one case becuse they all have same value

Script by using nested if-else

random_force = randi(12) //It will genrate a random force value between 1 and 12 which can be used further if random_force == 0 disp("There is no wind") elseif (random_force > 0) && (random_force < 7) disp("there is a breeze") elseif (random_force > 6) && (random_force < 10) disp("there is a gale") elseif (random_force > 9) && (random_force < 12) disp("it is a storm") elseif random_force == 12 disp("Hello Hurricane!") end

First if will check if force is zero and will print its corresponding string

Second,elseif will check if force is between 1 and 6 and will print its corresponding string

third elseif will check if force is between 7 and 9 and will print its corresponding string

Fourth elseif will check if force is 10 or 11 and will print its corresponding string

Last else if will compare value to 12 and return the corresponding string

You might be interested in
What are some good apps to download to screenshot your screen?
LenaWriter [7]

Answer:

AZ Screen Recorder.

Firefox ScreenshotGo Beta.

Screenshot Touch.

Screen Master.

Most personal assistant apps

7 0
3 years ago
How many people did you help today
Rashid [163]

Answer:

red

Explanation:

6 0
3 years ago
Read 2 more answers
Write a recursive method called repeat that accepts a string s and an integer n as parameters and that returns s concatenated to
svp [43]

Answer:

public static String repeat(String text, int repeatCount) {

   if(repeatCount < 0) {

       throw new IllegalArgumentException("repeat count should be either 0 or a positive value");

   }

   if(repeatCount == 0) {

       return "";

   } else {

       return text + repeat(text, repeatCount-1);

   }

}

Explanation:

Here repeatCount is an int value.

at first we will check if repeatCount is non negative number and if it is code will throw exception.

If the value is 0 then we will return ""

If the value is >0 then recursive function is called again untill the repeatCount value is 0.

6 0
3 years ago
Which of the statements is most likely true about the differences between the basic version and premium version of StreamPal
romanna [79]

Answer:

I

Explanation:

8 0
3 years ago
Read 2 more answers
Unlike when writing in a programming language, there are no set rules that must be followed when writing pseudocode. What do you
Elan Coil [88]

Answer:

Explanation:

Pseudocode may not have a set number of rules of guidelines but there are still some habits that should be followed. This includes having only one statement per line and add the END keyword to loops. Both of these rules/habits will drastically increase the readability of the pseudocode and allow you to know exactly where a certain loop starts and ends. Since loops can become difficult to read if they have a lot of code within them. Another good guideline to keep in mind is to simplify the code as much as possible do not add unnecessary pseudocode if it is not absolutely needed.

7 0
3 years ago
Other questions:
  • You must obey any special signs or instructions as you pass a construction zone.
    14·2 answers
  • The blank is the area on your screen where you can access the tab and menu options for word
    5·1 answer
  • The growing network of physical objects that will have sensors connected to the Internet is referred to as the ________.
    13·1 answer
  • C++ code pls write the code
    12·1 answer
  • What do you expect the future trends of an operating system in terms of (a) cost (b) size (c) multitasking (d) portability (e) s
    12·1 answer
  • What is computer system ?​
    9·2 answers
  • What does the term attenuation mean in data communication?
    11·1 answer
  • Based on three scores that the user inputs, display the average of the score and the letter grade that is assigned fort he test
    5·1 answer
  • Ceteris paribus, if a student could either earn money tutoring or working as a server in a restaurant, then increases to the wag
    5·1 answer
  • What are the dominant InfoSec-related credentials used to document knowledge and/or experience?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!