subject

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

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:40
Write c function that can replace all the positive elements to 0 and negative to 1 in undefined length one-dimensional array. test your program in the main program by defining one-dimensional array of 6 elements
Answers: 1
question
Computers and Technology, 21.06.2019 23:00
In a file-oriented information system, a work file stores relatively permanent data about an entity is created and saved for backup and recovery purposes stores records that contain day-to-day business and operational data is a temporary file created by an information system for a single task
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
If an appliance consumes 500 w of power and is left on for 5 hours, how much energy is used over this time period? a. 2.5 kwh b. 25 kwh c. 250 kwh d. 2500 kwh
Answers: 1
You know the right answer?
The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values...
Questions
question
Physics, 27.08.2021 01:00
question
Biology, 27.08.2021 01:00
question
English, 27.08.2021 01:00