Question
Engineering Problem solving with C++ OBJECTIVE Use an input file with weather data and write to an output file and the console only those records
Engineering Problem solving with C++
OBJECTIVE
Use an input file with weather data and write to an output file and the console only those records whose average temperature (F) is less than or equal 45 degrees. Also, for all records, compute the minimum, maximum, and average for the average temperature (F)
Sample Data (WeatherData.txt)
This file contains weather data from May 2015. There are 6 fields per record. The fields are: Day, Max Temp (F), Min Temp (F), Avg Temp (F), Precipitation (water), Precipitation (snow). There are 31 records one for every day of May.
WeatherData.txt
1 74 39 57 0.00 0.0 2 71 32 52 0.02 0.0 3 68 32 50 0.00 0.0 4 64 33 49 0.10 0.0 5 53 42 48 0.30 0.0 6 64 39 52 0.10 0.0 7 64 34 49 0.10 0.0 8 68 35 52 0.00 0.0 9 56 35 46 0.03 0.1 10 56 33 45 0.10 0.0 11 62 28 45 0.10 0.0 12 70 40 55 0.10 0.0 13 64 38 51 0.00 0.0 14 67 33 50 0.00 0.0 15 56 35 46 0.07 0.0 16 55 30 43 0.02 0.0 17 66 26 46 0.10 0.0 18 68 32 50 0.07 0.0 19 60 37 49 0.89 0.0 20 67 30 49 0.00 0.0 21 66 41 54 0.10 0.0 22 65 36 51 0.03 0.0 23 63 37 50 0.00 0.0 24 52 36 44 0.16 0.0 25 63 31 47 0.00 0.0 26 67 32 50 0.01 0.0 27 71 35 54 0.00 0.0 28 65 28 46 0.10 0.0 29 68 32 50 0.07 0.0 30 61 36 49 0.89 0.0 31 67 32 49 0.00 0.0
Instructions
1. Use the WeatherData.txt file for input. Do not ask the user for the file name.
2. Make sure you add a system(pause) before the return and before any exits.
3. You must check for fail on both the input and output files.
4. Compute the Average, Max, Min of the Avg Temp (F) for all records.
5. You will print to the output file only those records with average temperature <= 45. Also, you will output these records to the console (cout), nicely formatted.
6. You will display the Average, Max, and Min temperatures to the console (cout) only.
7. Make sure all your comments are accurate
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started