Project #6
(Canadian Weather)
(Due 9 Dec 05)
Every day in New Brunswick, the weather reporting stations send information to the Provincial Weather Center, in Saint John. At the center, some simple data processing is done on the stations' data to produce a report about the weather for the day. The data reported from each station consists of the number of hours of sunshine for the day (to the nearest tenth of an hour) and the temperature at each hour of the day (starting at midnight, 00:00, and ending at 11 pm, 23:00). The temperatures are reported in oC to the nearest tenth of a degree. Each day the data is collected into a file that has the same form. Here are the first few lines from the file for September 15, 2005. It indicates that there are 97 reporting stations. the next line is from station 1138; it indicates 2.1 hours of sunshine; this is followed by 24 hourly temperatures. The next line is for station 1142 and has similar information. Not every station makes a report every day.
97
1138 2.1 6.3 6.5 5.0 2.4
2.2 -1.7 0.8 4.7 5.8 8.3 9.1 and-13-more
1142 2.0 6.5 4.9 3.9 0.8
1.3 -2.5 3.3 6.3 5.7 9.3 8.3 and-13-more
1146 2.7 6.7 6.3 3.3 3.9
2.5 -0.5 2.7 4.5 8.6 8.0 11.7 and-13-more
1148 4.2 4.4 4.4 -0.1 -0.1 -2.5 -5.1 -3.2
0.6 1.9 4.5 6.9 and-13-more
You are to write a program to produce the report that the Weather Center needs. The report requires that your program output the following information to a file.
New Brunswick report for file 05sep15.txt
Province Averages: Sunshine 3.652 Temperature 5.834
for 97 Stations
Station Sunshine AverageTemp
1138 2.1-
7.563+
1142 2.0-
7.513+
1146 2.7-
8.383+
1148 4.2+
4.417-
.
. .
Hour Min Station
Max Station Temperature Gap
0 0.3 1567
9.2 1964
- +
1 -0.6 1704
8.6 1199
- +
2 -1.6 1432
6.5 1374 -
+
3 -3.6 1383
5.2 1964 -
+
4 -5.3 1399
3.4 1964 -
+
5 -6.7 1507
1.7 1251 -
+
6 -4.6 1343
4.3 1964 -
+
. .
. .
.
Sunshine/Temperature Correlation Coefficient: -0.052
Stations with both Hourly Max and Min: None
Your program must be designed to prompt for and read in the name of the data file, then read the data in that file to produce the report. The report is not to be displayed on the screen. Instead, the program must prompt for and read in the name of the file where it will write the report, then write the report there. Data files named 05sep15.txt, and 05sep16.txt are available on the I: drive at I:\jlwolfe\110 and P: drive at P:\courses\fall2005\COSC\COSC110\xxx\information (where xxx is the section number) for you to test your program on. The files 15report.txt and 16report.txt are available to show you the results you should be getting on this data. Two days before the project is due, I will make available other files that I want you to use as data when you hand in your program.
Hand in a Visual Studio printout of your well-documented program and printouts of the report files from the data files that I provide just before the due date. Also, copy your .cpp file to the P: drive, handin folder after naming it after yourself.
EXTRA CREDIT:
You might have noticed that the sample report above has elements that are not required. If you include these elements in your program's reports, you can get extra credit. There are three options; you may do any or all. The greater the difficulty, the more the option is worth.