View Full Version : Fortran Programming Help

12-07-2011, 11:59 PM
I am getting hung up on this program, could someone please help me out.

Input contains data on annual rainfall for several cities. Each line contains the name of the city (in columns 1 through 30) followed by the rainfall in inches (to two decimal places) in columns 32 through 37. The end is marked by the fake city zzzz.

The program will print the number of cities processed and the overall average (to two decimal place. Then it will print a table listing each city's name, rainfall amount, and its classification (dry, normal, or wet). A city with rainfall less than 15 percent of the overall average is considered dry, one with more than 2.5 times the average is considered wet, the rest are normal. The output should look like the outline below.

... Cities processed
Overall Average: ......

City Annual Rainfall Category
......... ...... .....
......... ...... .....

You must define and use the Subs FillLists and PrintTable and the functions
Average() [returns the average of the N numbers in the given array] and Category(rainfall, avg) [given a rainfall number, and the overall average, returns the corresponding category.

In reading the data on each city, you will need formatted READ (the city name may be more than one word as in Grand Rapids. Recall that this is done as follows.
READ (*,100) ..., ... ! the two vars for name of city and rainfall
100 FORMAT(A30, 2X, F6.2)