ESC 251 HW 11 Due: Sep. 29

Some of the intrinsic functions given in class (see September 18 notes) will be helpful in this assignment.

1)
(5 pts) The program segment below should warn the user of high temeperature readings. Assume temp is a double precision variable.

Determine if this segement works as intended (note, don't write a program to test this, just mentally trace through the logic using a few different values for temp.) Does the program segment work as intended?

If the program segment does not work as intended, re-write the IF-THEN block so that it works properly, then write a complete program. 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.5d0) THEN
WRITE(*,*) 'Temperature below normal'
ELSEIF(temp > 97.5d0) THEN
WRITE(*,*) 'Temperature normal'
ELSEIF(temp > 99.5d0) THEN
WRITE(*,*) 'Temperature slightly high'
ELSEIF(temp > 103.0d0) THEN
WRITE(*,*) 'Temperature dangerously high'
ENDIF

2)
(3 pts) Write a program that will ask the user to input a value x and test if the function

can be computed for that value of x. If y can be computed, the program should print the corresponding value of y. If y cannot be evaluted, the program should print out an appropriate error message. Test your program for two values of x that work and one that does not.
3)
(4 pts) The cost to ship a package depends on the weight according to the table below.
 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 an F90 program 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.

4)
(10 pts) Write an F90 program that will ask the user to input values of x,y and z. These values represent the coordinates of a point P(x,y,z) in 3-dimensional space.

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.