Question
Using OOP, write a C++ program that will indicate the number of days in a month the temperature was above average, below average, and at
Using OOP, write a C++ program that will indicate the number of days in a month the temperature was above average, below average, and at the average for the month of November. Using an array to count the number of days above average, below average, and average, read in an input file named NovTemps.txt that gives the temperature for each day for the month. The input file should be located in the current directory. If the temperature is above the average temperature, increment the count in the index of the array that holds the count for the days above average. If the temperature is below the average temperature, increment the count in the index of the array that holds the count for the days below average. If the temperature is equal to the average temperature, increment the count in the index of the array that holds the count for the days equal to the average temperature.
When the end of file has been reached, display the count for the number of days above average, the number of days below average, and the number of days equal to the average.
Be sure to place variables within the private accessor area of the class. Use a constructor to initialize the array elements to 0. No global variables. A submission of all code in main() will result in a grade of 0.
NovTemps.txt contains:
78
81
83
83
82
83
84
83
80
65
77
81
78
70
69
72
74
78
72
74
76
78
64
71
72
74
74
80
80
79
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