Computer Science
1107
AN INTRODUCTION
TO FORTRAN
PROGRAMMING
FOR SCIENTISTS AND
ENGINEERS
Fall 2001
Programming Assignment 2
Due date: Wednesday, September 19, 2001
Objective: To explicitly use the four stages of program
development in the creation of a small
FORTRAN 77 program.
Text Problem 13, page 109.
In order for a shaft with an allowable
shear strength of STREN lb/square-inch to transmit a torque of TORQUE
in-lbs, it
must have a diameter of at least DIAM inches, where DIAM is given by:
DIAM = (16*TORQUE/STREN)**(1.0/3.0)
If POWR horsepower is applied to the shaft
at a rotational speed of RS rpm, the torque is given by:
TORQUE = 63000*POWR/RS
For this assignment, create a FORTRAN program that
gets values for POWR, RS, and STREN as input from the user and then
calculates and displays the torque
developed and the required diameter to transmit that torque using the
following steps:
- Create a hand-drawn flow chart for the program using the appropriately
shapes boxes for start-stop, Input/Output, and computation as discussed
in class.
- Write out the algorithm for the entire program using pseudocode.
This should be written out by hand, not typed.
- Write the FORTRAN program, naming the source
code file lab2.f and including an explicit list of all Input and
Output variables as well as a short description of the problem in
a documentation section using comment
lines at the beginning of the program. Be careful to choose the types of
your variables appropriately.
- Run the program with the following inputs:
POWR (HP) |
RS (rpm) |
STREN (psi) |
20 |
1500 |
5000 |
20 |
50 |
5000 |
270 |
40 |
6500 |
Check your results by hand before creating your script file.
- Then hand in the following:
- The flow chart.
- The pseudocode listing.
- A script file containing all of the
following:
- A printout of the source program obtained by using the UNIX cat
command
- A compilation of the program obtained by using the f77
command
- Results of execution the program with the
three data sets obtained by using a.out
A brief paragraph discussing your conclusions about the conditions for
a shaft to transmit a high torque. This can either be separately
typed or neatly hand-written.
Note: For this and
all programming assignments you should follow good software engineering
principles including documenting your program with comments and using
meaningful names for variables. Failure to do this will lead to reduced
credit.
For this and subsequent assignments, you have the option of
working in teams of two people. In this case, turn in one copy of your
results with both names included on every page of every item
submitted.