Assignment 6, Spring 2003

Due Tuesday 8th April

This assignment is to be completed under the unix system: use the submit utility when it is ready.


For Lab 9 you read a lot of meteorological data from a file and plotted graphs from it. This time, you are going to read the same data from the same file, but store it in arrays in memory. Then allow the user to ask some simple questions about the data, and answer them.


The file is the 1999 Fort Collins hourly weather observations file. You can see it on the web, but you do not need to download it. Your program can have direct access to the file on the server. If your program opens the file called "/usr/home/www/class/een118/weather.txt" successfully, it can just read the data.


Every line in the file contains nine integers. They are in order: year, month, day, time, temperature, humididty, wind speed, wind direction, and atmospheric pressure. Read all potentially useful data from the file into large arrays before accepting any instructions from the user.


The user should then be offered a menu of choices, which must include: Exit from the program; find the minimum temperature for a particular month; find the maximum temperature for a particular month; find the average temperature for a particular month. For the three real queries, the program should also ask the user which is the month of interest, then find the answer and print it in a user-friendly manner.


For Extra Credit Implement some other more interesting queries. By "more interesting", I mean not just more of the same, but something more original. Find the hottest/coldest/windiest month or day, or perhaps ask which was the warmest saturday, or who knows what.


A possible sample run. The data printed is not correct, I'm just making it up.
$ run
Options: [MMIN] find minimum temp in a month,
         [MMAX] find maximum temp in a month,
         [MAVG] find average temp in a month,
         [DAVG] find average temp for a day of the week,
         [YAVG] find average temp for the whole year.
         [EXIT] exit.
Choice: MMIN
Which month (1=Jan, 12=Dec)? 7
The coldest temperature in July was 54 degrees,
on 1997-07-27 at 0300 hrs.
Choice: DAVG
Which day (0=Sun, 6=Sat)? 5
The average Friday temperature was 46 degrees.
Choice: EXIT
OK, bye.



Remember, strings are case sensitive, "MMIN"=="mmin" is false in C++.