Remember to indent the bodies if your IF-THEN statements.
If the program segment does not work as intended, re-write the IF-THEN block so that it works properly, then write a complete script. Test your program using values for temp that will ensure that each branch of the IF-THEN block is being accounted for.
if(temp < 97.5) disp('Temperature below normal') elseif(temp > 97.5) disp('Temperature normal') elseif(temp > 99.5) disp('Temperature slightly high') elseif(temp > 103.0) disp('Temperature dangerously high') end
|Weight (lbs)||Cost ($)|
|0.00 - 2.00||$10|
|2.01 - 5.00||$20|
|5.01 - 10.00||$40|
|10.01 - 20.00||$60|
|20.01 - 40.00||$80|
|40.01 - 75.00||$100|
|> 75.01||Can't be shipped|
Write a MATLAB script that will ask the user to input a weight, then print out the shipping cost. Select your own test cases that will ensure each branch is working correctly.
If the point P(x,y,z) is inside the sphere with center (2,3,-5) and radius 1.1, the program should display the message 'Inside Sphere 1'
If the point P(x,y,z) is inside the sphere with center (3,1,-4) and radius 0.5, the program should display the message 'Inside Sphere 2'
For any other case, the program should display the message 'Point not in any sphere'
Test your program using the points (3.25,1.1,-3.9), (2.1,3.1,-4.8) and (10,10,-10). You can assume that a point can only be in one of the spheres.