Question
C++ Write a program that will compare current hourly temperatures with the previous day's hourly temperatures. Specifications: 1. The program will read data from a
C++ Write a program that will compare current hourly temperatures with the previous day's hourly temperatures. Specifications:
1. The program will read data from a file named "dailyTemps.txt." The first six items in the file are strings corresponding to dates of the data. The strings that start the file will look (for example) like this:
June 23, 2017 June 24, 2017
Following the dates will be doubles that represent data pertaining to hourly temperature readings for two days. The doubles correspond to readings from 12:00am to 11:00pm for the two days. Note that the temperature for 12:00am of day 1 is followed by the temperature for 12:00am of day two, etc. In other words, you must read any given hourly temperature for both days consecutively.
You will read the values into two one dimensional arrays to hold them so you do not have to keep reading the file. This assignment DOES NOT require use of a two-dimensional array and you should not use one as it will complicate your life unnecessarily. You will display all the temperatures under the appropriate day heading, something like this after you have read them: Hour June 23, 2017 June 24, 2017 1 55 57 2 54 57 ... ... ... 24 67 43 ****************************************************************** Mean Temperature 79 74 Standard deviation 18 16
ALL output is to go to the console window in JGrasp. DO NOT write the output data to a data file. You will need to compute the mean (average) temperature for each day and the standard deviation (variability) in temperatures for each day. The mean temperature is computed by adding up all the hourly temperatures and dividing by the total number of temperatures (24) for the day. The standard deviation is computed by:
1. computing the mean temperature.
2. going through a loop for each hourly temperature in which you - subtract the mean temperature from the current temperature - square that result - accumulate that result into a total (these steps compute the numerator in the expression under the radical below)
3. Divide the number computed in the loop above by the number of temperatures (N). This step provides the value under the radical in the formula.
4. Take the square root of that result - this is the standard deviation of the list of temperatures.
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