Question
C++ C++: Objectives: Use loops. Read from a file. Calculate the mean and find the maximum value in a file. Tasks: 1. Read precipitation measured
C++
C++: Objectives: Use loops. Read from a file. Calculate the mean and find the maximum value in a file. Tasks: 1. Read precipitation measured between 1/1/2018 and 2/21/2018 at the two NWS instruments nearest Mount Laurel, NJ. The values are contained in the file precip.txt. Each file line consists of a date and a precipitation value, e.g. 2/11/2018 1.18. 2. Find the day with the highest precipitation and print the date and the value. 3. Calculate the mean daily precipitation over the above time period and print the value.
4. Include a screenshot of the output.
Note: Precipitation data was obtained from https://www.ncdc.noaa.gov/cdo-web/search
precip.txt:
1/1/2018 0 1/2/2018 0 1/3/2018 0 1/4/2018 0 1/5/2018 0.38 1/6/2018 0 1/7/2018 0 1/8/2018 0 1/9/2018 0.07 1/10/2018 0 1/11/2018 0 1/12/2018 0.04 1/13/2018 0.67 1/14/2018 0 1/15/2018 0 1/16/2018 0 1/17/2018 0.21 1/18/2018 0 1/19/2018 0 1/20/2018 0 1/21/2018 0 1/22/2018 0 1/23/2018 0.21 1/24/2018 0.2 1/25/2018 0 1/26/2018 0 1/27/2018 0 1/28/2018 0.32 1/29/2018 0.18 1/30/2018 0.06 1/31/2018 0.08 2/1/2018 0 2/2/2018 0.24 2/3/2018 0 2/4/2018 0 2/5/2018 0.94 2/6/2018 0 2/7/2018 0.05 2/8/2018 0.82 2/9/2018 0 2/10/2018 0 2/11/2018 1.18 2/12/2018 1 2/13/2018 0 2/14/2018 0 2/15/2018 0.2 2/16/2018 0.49 2/17/2018 0.05 2/18/2018 0.43 2/19/2018 0 2/20/2018 0 2/21/2018 0 1/2/2018 0 1/3/2018 0 1/6/2018 0 1/7/2018 0 1/8/2018 0 1/9/2018 0.07 1/10/2018 0 1/11/2018 0 1/12/2018 0.03 1/13/2018 0.67 1/14/2018 0 1/16/2018 0 1/19/2018 0 1/20/2018 0 1/21/2018 0 1/22/2018 0 1/23/2018 0.12 1/24/2018 0.4 1/25/2018 0 1/26/2018 0 1/27/2018 0 1/28/2018 0.4 1/29/2018 0.11 1/30/2018 0.11 1/31/2018 0 2/1/2018 0 2/2/2018 0.22 2/3/2018 0 2/4/2018 0 2/5/2018 0.92 2/6/2018 0 2/7/2018 0.34 2/8/2018 0.54 2/9/2018 0 2/10/2018 0 2/11/2018 1.18 2/12/2018 1.02 2/13/2018 0 2/14/2018 0 2/15/2018 0.21 2/16/2018 0.46 2/17/2018 0.04 2/18/2018 0.42 2/19/2018 0 2/20/2018 0
weather.csv:
STATION,NAME,DATE,PRCP,SNOW,SNWD US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/1/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/2/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/3/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/4/2018,,,4 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/5/2018,0.38,5.5,6 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/6/2018,0,0,5 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/7/2018,0,0,4 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/8/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/9/2018,0.07,,4 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/10/2018,0,0,3 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/11/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/12/2018,0.04,,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/13/2018,0.67,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/14/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/15/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/16/2018,0,0,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/17/2018,0.21,1.1,1 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/18/2018,0,0,1 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/19/2018,0,0,1 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/20/2018,0,0,1 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/21/2018,0,0,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/22/2018,0,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/23/2018,0.21,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/24/2018,0.2,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/25/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/26/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/27/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/28/2018,0.32,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/29/2018,0.18,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/30/2018,0.06,0,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",1/31/2018,0.08,0.5,1 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/1/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/2/2018,0.24,0,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/3/2018,0,0,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/4/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/5/2018,0.94,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/6/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/7/2018,0.05,0,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/8/2018,0.82,0,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/9/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/10/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/11/2018,1.18,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/12/2018,1,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/13/2018,0,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/14/2018,0,0, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/15/2018,0.2,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/16/2018,0.49,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/17/2018,0.05,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/18/2018,0.43,1.5,1 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/19/2018,0,0,0 US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/20/2018,0,, US1NJBT0006,"MOORESTOWN TWP 0.6 SE, NJ US",2/21/2018,0,0, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/2/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/3/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/6/2018,0,0, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/7/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/8/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/9/2018,0.07,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/10/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/11/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/12/2018,0.03,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/13/2018,0.67,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/14/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/16/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/19/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/20/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/21/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/22/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/23/2018,0.12,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/24/2018,0.4,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/25/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/26/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/27/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/28/2018,0.4,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/29/2018,0.11,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/30/2018,0.11,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",1/31/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/1/2018,0,0, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/2/2018,0.22,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/3/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/4/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/5/2018,0.92,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/6/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/7/2018,0.34,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/8/2018,0.54,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/9/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/10/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/11/2018,1.18,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/12/2018,1.02,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/13/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/14/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/15/2018,0.21,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/16/2018,0.46,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/17/2018,0.04,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/18/2018,0.42,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/19/2018,0,, US1NJBT0061,"MOORESTOWN TWP 1.0 SSW, NJ US",2/20/2018,0,0,
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