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

For these problems you do not need to write entire MATLAB functions or scripts,

ID: 3815829 • Letter: F

Question

For these problems you do not need to write entire MATLAB functions or scripts, just the condition statements requested. Write a selection statement that will print 'warm' if the temperature is between 80 and 90, inclusive. Write a selection statement that will print 'hot' if the temperature >=80, 'pleasant' if the temperature >= 60, 'cool' if the temperature is >=45, 'cold' otherwise. If integer variable current Number is odd, change its value so that it is now 3 times current Number plus 1, otherwise change its value so that it is now half of current Number Find the largest of three scalar numbers x y and z and assign the value to the variable largest.

Explanation / Answer

1a.
if temperature >= 80 && temperature <= 90
fprintf("warm")
end

1b.
if temperature >= 80
fprintf("hot")
elseif temperature >= 60
fprintf("pleasant")
elseif temperature >= 45
fprintf("cool")
else
fprintf("cold")
end

1c.

if mod(currentNumber, 2) == 1
currentNumber = currentNumber*3 + 1
else
currentNumber = currentNumber / 2
end

1d.

largest = x
if y > largest
largest = y
end

if z > largest
z = largest
end

Please rate positively if this answered your question.