Skip to content

Commit

Permalink
Add some FORTRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Dec 14, 2020
1 parent c2ef543 commit 4ac7d70
Show file tree
Hide file tree
Showing 106 changed files with 6,881 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lbs290f/HANDOUT.PLAN.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

Handout Plan for the class

Syllabus
Schedule
Programming assignments and policies
66 changes: 66 additions & 0 deletions lbs290f/assn/assn1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

LBS290F Spring 1992

ASSIGNMENT 1 - Average three numbers

Due Date: April 3, 1992 11:59PM

The purpose of this program is to simply type in the following FORTRAN
program and run the program. Then turn the program in using the automated
grade program. Use the handout titled "Using the FORTRAN Compiler" for
more details.

*
* average3 - Computes the average of three numbers
*
* Written by: C. Severance 16Mar92
*
* Declare the variables:
*
REAL A,B,C,TOT,AVE
*
* Welcome the user
*
PRINT *,'Welcome to the automatic average program'
*
* Prompt the user for the three variables
*
PRINT *,'Enter the first number -'
READ *,A
PRINT *,'Enter the second number -'
READ *,B
PRINT *,'Enter the third number -'
READ *,C
*
* Print the numbers out
*
PRINT *,'The numbers are -',A,B,C
*
* Calculate the total and average
*
TOT = A + B + C
AVE = TOT / 3.0
*
* Print the values out and end the program
*
PRINT *,'Total - ',TOT
PRINT *,'Average - ',AVE
END

---- Example Execution -----

$ fort average3.f
File average3.f:
MAIN:
$ a.out
Welcome to the automatic average program
Enter the first number -
12
Enter the second number -
20
Enter the third number -
19
The numbers are - 1.200000000E+001 2.000000000E+001 1.900000000E+001
Total - 5.100000000E+001
Average - 1.700000000E+001
$
54 changes: 54 additions & 0 deletions lbs290f/assn/assn10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
LBS290F Spring 1992

ASSIGNMENT 10 - Inventory Program

Due Date: April 27, 1992 11:59 PM

The purpose of this program is to track an inventory of a small business.

The program will track up to 10 parts with part numbers ranging from 1
to 10.

Each line read by the program is an inventory control record. The first
number indicates the type of transaction - 1 Stock 2 Sell 3 List.
The second number is the part number. The last number is the number
of parts bought or sold for type 1 or 2 records.

Example input:

1 2 20 Stocked 20 of part 2
2 4 5 Sold 5 of part 4
3 0 0 List the current inventory

The program must check for an illegal transaction type. The program
must check for an error in the part number. The program also
must also not allow product to be sold if there is none in stock.

Example execution:

$ a.out
Enter the inventory control record: 6 0 0

Error - Illegal transaction type 6, please enter number between 1 and 3

Enter the inventory control record: 1 20 90

Error - Part number 20 too large, maximum part number is 10

Enter the inventory control record: 2 4 5

Error - current inventory of part 4 is 0, cannot sell 5

Enter the inventory control record: 1 2 20
Enter the inventory control record: 1 4 10
Enter the inventory control record: 2 2 5
Enter the inventory control record: 3 0 0

PART COUNT
---- -----
2 15
4 10

Enter the inventory control record: (CTRL-D)

Thank you for using the inventory program.
57 changes: 57 additions & 0 deletions lbs290f/assn/assn11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
LBS290F Spring 1992

ASSIGNMENT 11 - Sorting Scores

Due Date: April 29, 1992 11:59 PM

The purpose of this assignment is to sort a list of grades and
print the mean, median, maximum, and minimum of the grades.

The input to the program will be 10 grade records. Each grade record will
have a student number and a grade value.

Read the numbers into two arrays. Sort the arrays by the grade from
highest to lowest grade. Then print out the sorted arrays.

Calculate the mean, maximum, and minimum of the scores.

The median of the scores if the fifth score. Print out the median score
and the student number of the student who had the median score.

Print the maximum and minimum score and the student who received the score.

Example execution:

$ a.out
Enter the student records
111111 90
123456 50
333333 70
202020 60
101020 75
123123 85
161161 95
262262 85
191819 90
888888 65

Student records sorted by grade:

161161 95
111111 90
191819 90
123123 85
262262 85
101020 75
333333 70
888888 65
202020 60
123456 50

Median grade 85 student 262262

Mean grade 76.5

Maximum grade 95 student 161161

Minimum grade 50 student 123456
89 changes: 89 additions & 0 deletions lbs290f/assn/assn12.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
LBS290F Spring 1992

ASSIGNMENT 12 - Heat Flow in a Plate

Due Date: April 29, 1992 11:59 PM

The purpose of this program is to simulate heat flow in a solid metal
plate.

The plate to be simulated will be 10 centimeters by 10 centimeters.
The plate will start at 30.0 degrees Celsius across the whole plate.

There will be heat and cold sources placed at various points on the plate
as follows:

Y-Position X-Position Temperature
------------------------------------------
1cm 1cm 100.0 Celsius (Boiling)
6cm 3cm 10.0 Celsius
5cm 1cm 80.0 Celsius
10cm 10cm 0.0 Celsius

We are to simulate the flow of heat from these sources as a function of
time and calculate the temperature at all the positions of the plate for
successive time steps.

You will have to write 5 loops to perform the heat flow calculation. One loop
for each edge, and one for the central portion. For the top edge of
the plate each cell will be calculated by the average of the three
neighboring cells. For example, to compute the new temperature of
position 1cm, 3cm you would average the temperatures of the cells at
1,2 1,3 1,4 and 2,3.

Left
Edge

------------------------------------------------- Top Edge
| 1,1 | 1,2 | 1,3 | 1,4 |
| | | | |
| | | | |
| | | | |
- - - - - - - - - - - - - - - - - - - - - - - - -
| 2,1 | 2,2 | 2,3 | 2,4 |
| | | | |
| | | | |
| | | | |
- - - - - - - - - - - - - - - - - - - - - - - - -
| 3,1 | 3,2 | 3,3 | 3,4 |
| | | | |


To compute the new temperature of one of the interior cells you
average the temperature of the cell and its four neighbors.

In the following example cell 2,3 would be computed as the average of cells

1,3 2,2 2,3 2,4 and 3,3


Left
Edge

------------------------------------------------- Top Edge
| 1,1 | 1,2 | 1,3 | 1,4 |
| | | | |
| | | | |
| | | | |
- - - - - - - - - - - - - - - - - - - - - - - - -
| 2,1 | 2,2 | 2,3 | 2,4 |
| | | | |
| | | | |
| | | | |
- - - - - - - - - - - - - - - - - - - - - - - - -
| 3,1 | 3,2 | 3,3 | 3,4 |
| | | | |


It is important NOT to change the temperature of the fixed temperature
cells specified above.

Run the simulation for 10 time steps and print out the temperature at
the following positions on the plate after each time step.

Y-Position X-Position
-----------------------
2cm 2cm
10cm 1cm
4cm 2cm

19 changes: 19 additions & 0 deletions lbs290f/assn/assn13.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
LBS290F Spring 1992

ASSIGNMENT 13 - Payroll Using Subroutines

Due Date: May 4, 1992 11:59 PM

The purpose of this program is to use subroutines.

In this program you will perform exactly the same as program 9. However
in this program you must write and call a subroutine to calculate the
gross pay, and taxes for the employee.

The subroutine should be named CALCPAY. The header for the subroutine
should be as follows:

SUBROUTINE CALCPAY(GP,TAXES,RATE,HOURS)
REAL GP,RATE,HOURS

The input and output for the program are the same as program 9.
34 changes: 34 additions & 0 deletions lbs290f/assn/assn14.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
LBS290F Spring 1992

ASSIGNMENT 14 - Finding Max, Min, Mean, Mean and Sort Again

Due Date: May 6, 1992 11:59 PM

The purpose of this program is to use functions and subroutines.

In this program you will read in an array of up to 20 numbers.

You will write and call the following functions:

REAL FUNCTION FINDMAX(ARR,N)
REAL ARR(20)
INTEGER N

REAL FUNCTION FINDMIN(ARR,N)
REAL ARR(20)
INTEGER N

REAL FUNCTION CALCMEAN(ARR,N)
REAL ARR(20)
INTEGER N

SUBROUTINE SORTNUM(ARR,N)
REAL ARR(20)
INTEGER N

You must use these functions to calculate the max, min, and mean of
the numbers. The main program should print out the max, mean, and
min of the numbers. After the main program has done these calculations
it should call your subroutine to sort the numbers. After the
subroutine returns, the main program should print out the sorted
numbers.
34 changes: 34 additions & 0 deletions lbs290f/assn/assn2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

LBS290F Spring 1992

ASSIGNMENT 2 - Speed Conversion

Due Date: April 6, 1992 11:59PM

The purpose of this program is to prompt for a number of miles per hour,
convert it to feet per second, and print out the converted speed in
feet per second.

Useful numbers:

5280 feet per mile
3600 seconds per hour

One technique might be to convert from miles per hour to feet per hour
and then convert from feet per hour to feet per second.


Example execution:

$ a.out
Welcome to the speed conversion program
This program was written by: (Your name goes here)
Enter speed in miles per hour - 60.0
Converting from miles per hour to feet per second
Speed is 8.800000000E+001 feet per second
Thank you for using the speed conversion program
$

The output of your program must look EXACTLY the same as the above
program. Put in your own name where indicated.

Loading

0 comments on commit 4ac7d70

Please sign in to comment.