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

Assume the following 3 variables describe a set of variables: Weather – A numeri

ID: 675528 • Letter: A

Question

Assume the following 3 variables describe a set of variables:

Weather – A numeric value between 20 and 120

Schedule – A numeric value between 0 and 5 that indicates your “business”. 0 means

nothing going on, 5 means “packed schedule”

LikeRunning – A numeric value between 0 (hate running) and 10 (love running)

Write a MATLAB script that:

i) ii)

a. b.

Inputs 3 values for the 3 variables
Checks if the values belong in the predefined range
If all the values are within the predefined range, display “Going for a Run” or “Not going for a Run” based on the values of these variables.
Else display a message to to user informing about the mistake with the input values

The logic that determines which output to display is given by the following flowchart:

No Display "Not going for a Run LikeRunning>4 Yes No No Display "Not Going for a Run Schedule >2 45cWeatherc90 Yes Yes Display "Not going for a Run Display "Going for a Run"

Explanation / Answer

weather = input('Enter the weather within the range 20 and 120: ');

schedule = input('Enter the schedule within the range 0 and 5 : ');

likeRunning = input('Enter your liking on a 10 point scale, 0 for hate running, 10 for love running: ');

if((weather < 20 || weather > 120) || (schedule < 0 || schedule > 5) || (likeRunning < 0 || likeRunning > 10))

display 'Input values are out of range. Please follow the prompt.';

else

if(likeRunning >= 4)

if(schedule > 2)

display 'Not going for a run.';

else

if(weather > 45 && weather < 90)

display 'Going to run.';

else

display 'Not going for a run.';

end

end

else

display 'Not going for a run.';

end

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote