Answered You can hire a professional tutor to get the answer.

QUESTION

i am supposed to create a program that reads data from a given weather data file and prints seleted information from that file, im unsure how to

i am supposed to create a program that reads data from a given weather data file and prints seleted information from that file, im unsure how to accomplish this or even how to start as i am very new to programming, these are my given instructions:

A remote weather station saves monthly data in a text file. Data is recorded once a day for a month, then transmitted over the Internet to a weather analysis centre. There are six data values recorded every day as detailed below. You are to create program that reads the weather data file and creates a monthly synopsis file.

given data:

8.7 9.9 4.4 0.7 0 1031

0.2 0.7 4.6 7.4 0 1035

2.4 2.2 0.7 9.0 0 1022

3.0 8.7 2.0 6.2 0 1013

4.2 7.3 6.9 8.3 6 960

3.1 8.5 7.4 0.6 4 971

5.0 6.4 3.7 0.2 0 982

3.0 5.7 8.0 6.4 0 1027

4.9 6.6 8.9 4.3 0 1037

5.1 6.9 7.4 2.2 0 1039

5.7 7.0 7.9 9.9 0 1024

0.6 1.0 3.3 5.0 5 1011

3.8 2.1 0.7 0.4 7 998

4.7 3.0 5.8 0.8 4 962

3.4 2.8 5.0 8.8 2 968

2.3 1.8 8.0 9.1 8 990

7.1 9.6 9.3 6.9 0 1012

6.9 8.8 5.4 2.3 0 1015

6.2 8.9 4.0 8.0 0 1026

6.3 9.1 2.2 6.3 0 1028

7.2 9.9 8.7 4.3 0 1025

7.4 0.0 9.0 5.5 0 1009

5.4 8.0 4.7 8.7 0 989

3.7 7.1 7.9 7.7 4 971

2.2 5.8 5.5 0.5 4 952

2.4 5.0 7.7 8.8 1 961

4.1 6.8 8.4 7.0 4 970

6.0 7.7 2.0 0.2 0 997

6.9 8.8 8.6 8.3 0 1008

7.8 9.7 7.0 4.2 0 1017

This is one line (or one day) of data from the weather data file: 28.7 19.9 14.4 70.7 0 1031 The data items are delimited with spaces. There is a new line character at the end of each line with the possible exception of the last line. The data items are in order:

1. Daily high temperature in degrees Celsius.

2. Daily low temperature in degrees Celsius.

3. Daily maximum observed wind speed in kilometres per hour.

4. Daily average humidity in percent.

5. Total daily rainfall in millimetres.

6. Barometric pressure in millibars.

Items 1 to 4 are floating point values to one decimal place accuracy. Items 5 and 6 are integer values.

The synopsis file does not report any information on the humidity or the barometric pressure. These items can be discarded as they are read. The synopsis file should report the maximum daily high temperature and average daily high temperature as shown above. The minimum daily high temperature is not reported. The minimum daily low temperature and average daily low temperature should be reported as shown above. The maximum daily low temperature is not reported. The maximum and average wind speeds are reported as shown. The minimum wind speed is not reported. Finally, the maximum and average rainfall amounts are reported as shown. The minimum rainfall is not reported. You do not need to be concerned with rounding when calculating the average rainfall. The amount can be truncated.

The synopsis file should be formatted as above. You do not need to match exactly the number of spaces between columns, but the data should align approximately as in the example provided. You can assume there will never be negative values. You can assume the temperature will not exceed 99.9, the wind speed will not exceed 999.9 and the rainfall will not exceed 999. You should pad your output variables with spaces. High temp, low temp and wind should be printed to one decimal place accuracy. Rain values should be integers. Floating point values should display the decimal point, even when the decimal value is zero.

Those of you who have prior programming experience might be tempted to read the data into arrays prior to processing it. Arrays are not necessary for this assignment. If you use arrays, you will lose marks.

Error Checking and other requirements.:

The input file does not indicate the number of days. There could be 28, 29, 30 or 31 days of data in the file. Thus, you cannot use a counting loop to read the data. Your program should test for the following types of file errors. 1. Failure to open the input file. 2. Failure to open the output file. 3. Input file has no data. 4. Input file has corrupt data. In all of these cases the program should perform any necessary clean up, then exit with the appropriate error message. You can test for condition 1 by intentionally entering an invalid file name. You can test for condition 2 by intentionally attempting to open a file in a non-existent folder. You can test for condition 3 by creating, saving and opening an empty text file. You can test for condition 4 by taking one of the input files and altering one of the data items to xxx or some other non-numerical value.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question