The data will be given to you in a file that is in a comma


The data will be given to you in a file that is in a comma separated format. We will be using the commas to determine where each piece of the input starts and begins. Samples of the data will be given below. After you read in all the data for a station you will output a summary for that station. There are three types of data that will be included and so there will be three types of summaries. Details on those will be below

Input

Below is a sample for a few of the weather stations. A complete list of the stations will be attached.

STATION,STATION_NAME,ELEVATION,LATITUDE,LONGITUDE,DATE,TPCP,Missing,Consecutive Missing,MNTM,Missing,Consecutive Missing
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150101,23,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150201,722,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150301,211,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150401,1198,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150501,671,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150601,647,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150701,768,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150801,112,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20150901,1592,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20151001,20,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20151101,296,0,0,-9999,0,0
GHCND:US1VACP0007,CULPEPER 6.1 W VA US,177.7,38.4595,-78.1136,20151201,193,0,0,-9999,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150101,799,0,0,12,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150201,563,0,0,-12,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150301,998,0,0,67,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150401,1183,0,0,142,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150501,614,0,0,208,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150601,1585,0,0,237,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150701,965,0,0,248,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150801,249,0,0,238,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20150901,1459,0,0,219,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20151001,1225,0,0,140,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20151101,614,0,0,113,0,0
GHCND:USC00442009,CORBIN VA US,67.1,38.2022,-77.3747,20151201,97,0,0,89,13,7
GHCND:USC00440187,AMELIA 4 SW VA US,105.2,37.3451,-77.9781,20150101,814,0,0,23,4,1
GHCND:USC00440187,AMELIA 4 SW VA US,105.2,37.3451,-77.9781,20150201,941,0,0,-7,3,1
GHCND:USC00440187,AMELIA 4 SW VA US,105.2,37.3451,-77.9781,20150301,1065,0,0,75,5,1
GHCND:USC00440187,AMELIA 4 SW VA US,105.2,37.3451,-77.9781,20150401,1086,0,0,148,1,1
GHCND:USC00440187,AMELIA 4 SW VA US,105.2,37.3451,-77.9781,20150501,329,0,0,206,0,0
GHCND:USC00440187,AMELIA 4 SW VA US,105.2,37.3451,-77.9781,20150601,1880,0,0,244,1,1
GHCND:USC00440187,AMELIA 4 SW VA US,105.2,37.3451,-77.9781,20150701,929,0,0,249,4,2
GHCND:USC00440187,AMELIA 4 SW VA US,105.2,37.3451,-77.9781,20150801,694,0,0,242,3,1

The sample above shows all three of the types of input that will be found in our tests. All the input will start with a header line like the one at the top of the input and it should be ignored. Let me explain each of the columns in the data

  1. STATION - this is the official station identification. We won't be displaying this.
  2. STATION_NAME - this is the name for the station. In our summary, we will be displaying this.
  3. ELEVATION - this is the elevation for the station. We will be displaying this.
  4. LATITUDE - this is the latitude of the station. We will be displaying this.
  5. LONGITUDE - this is the longitude of the station. We will be displaying this.
  6. DATE - this is the date for the reading. We won't be displaying this.
  7. TPCP - this is the total precipitation recorded by the station in tenths of a millimeter. We will be displaying this but it will be converted to inches.
  8. Missing - this is a number representing how many days in the month there was missing data. We will not be displaying this data.
  9. Consecutive - this is a number of consecutive days when the precipitation was not recorded. We will not be displaying this data.
  10. MNTM - this is the mean temperature recorded by the station. -9999 indicates it wasn't recorded. If it was recorded it is in Celsius.  It is recorded in tenths of a degree.  So for example 12 is really 1.2 degrees Celsius. We will be displaying this in Fahrenheit. If a station shows -9999 then we will use 0 for that report.
  11. Missing - this is a number representing how many days in the month there was missing data. We will not be displaying this data.
  12. Consecutive - this is a number of consecutive days when the temperature was not recorded. We will not be displaying this data.

The set of data for Culpeper is what I'm calling good data. It has most of the data but it is missing temperature data. That is represented by the -9999. It has all 12 months of data and so we would display this data. See the output below.

The set of data for Corbin is what I'm call all good data. It has all of the data recorded for it, including the temperature and it has all 12 months of data. See the output below.

The set of data for Amelia is what I'm calling bad data because it only has 8 months worth of data. Any set of data that is fewer than 12 months is "bad data". See the output below.

Output

If your program were run with the input above this is what the output should be:

STATION_NAME    ELEVATION   LATITUDE    LONGITUDE   TPCP    MNTM
CULPEPER 6.1 W VA US    177.7   38.4595 -78.1136    2.11713 0
CORBIN VA US    67.1    38.2022 -77.3747    3.396   57.515
AMELIA 4 SW VA US:  too few readings

NOTE: All the data in the output is TAB separated. Failure to separate each item on the line with a tab will most likely result in a project that scores very badly because my test code will use the tabs to break apart each line. There is NO tab at the end of the line, just an endl or newline character.

Requirements

Below is a set of requirements you must adhere to:

  1. You must prototype the functionvoid weatherSummary( string inputfile, string outputfile );in a file nameProject2.hPlease pay attention to the spelling and capitalization.
  2. You may not store the data in an array, vector, etc. as you read it in. Simply process it as you go.
  3. You may not use the STL or other code libraries outside of the ones we've used in examples, e.g. string, iostream, iomanip, etc.
  4. The use of global variables is prohibited. Pass your variables into your functions.
  5. You must write at least two additional functions. That's a total of at least 3 functions.
  6. Follow the style guidelines posted in Canvas.
  7. This is an individual assignment, you may not get any unauthorized assistance.

Procedure

Many times I'm asked how to get started. For this project I'd start by reading in the data and the simply printing it back out. That way you'll know that you are reading in the data correctly. Once you can do that, then I would work on figuring out when the weather station data switched from one station to the next. Once you've got that, then you'll know that you can compute the average for any station that is given.

I would write a function for reading in the data and displaying the data. I would also write a function for converting the precipitation from millimeters to inches and one for converting Celsius to Fahrenheit.

Testing

For this project I have ten tests that use the following pattern:

  1. All Good Data 1 set
  2. Good data no temp data 1 set
  3. Not enough data 1 set
  4. More than 1 set of all good data
  5. More than 1 set of data missing temp
  6. More than 1 set of not enough data
  7. Random amounts of all 3 sets of data
  8. Random amounts of all 3 sets of data
  9. Random amounts of all 3 sets of data
  10. Random amounts of all 3 sets of data

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: The data will be given to you in a file that is in a comma
Reference No:- TGS01289104

Now Priced at $40 (50% Discount)

Recommended (92%)

Rated (4.4/5)