Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

and all Course CCW 04. Simple Conditio dom number in rang Problem Description Th

ID: 3792267 • Letter: A

Question



and all Course CCW 04. Simple Conditio dom number in rang Problem Description The test suite generates a random number and assigns it to the variable RandomNumber. write a script that checks if the value assigned to RandomNumber is between 0 and 10 (consider values of exactly 0 and exactly 10 to be in range). If the value is in this range, assign the string "The number is in range." to the variable CheckRange. If the value is not in this range, assign the string The number is out of range." to the variable CheckRange. NCHAR Solution MATLAB Documentation Enter the commands for your script here Note the 3 a 1, (Random Number

Explanation / Answer

Code:

RandomNumber = 2+5*rand(1,1);

CheckRange = "The number is out of range.";
if (RandomNumber<10 && RandomNumber>0)
CheckRange = "The number is in range.";
end
disp(CheckRange);

Comment: We use assert when we need to throw an error. Normal if loop is sufficient for the checking this condition. All the best.