Question
Instructions Write a C++ program to determine the average temperature for a four-day holiday weekend in various cities in Arizona, and display the highest and
Instructions
Write a C++ program to determine the average temperature for a four-day holiday weekend in various cities in Arizona, and display the highest and lowest temperatures for the state.
Requirements:
In main have the user input a text file name, then have the user repeatedly:
-input the city name (using getline) followed by 4 temperatures. You do not know how many cities the user will be entering.
->input validation: the temperature entered must be 175 or below and -50 or above.
-use function Calc_Avg_Temp to calculate the average temperature for the city, return it to main and display it there (to 1 decimal).
-use a second function to find the highest temperature for the city, return it to main via a reference variable and display it in main.
-use a third function to find the lowest temperature for the city, also return it to main via a reference variable and display it in main.
-in main write the city name, high temperature and low temperature to the text file.
-process another city (your program should use a loop that terminates only when the user enters the word done).
In a fourth function read the file to determine the city with the highest temperature and the city with the lowest temperature, return the two city names and temperatures to main using reference variables, and display, with appropriate descriptions, these two cities and their temperatures in main.
Data to use for screen prints:
Friday | Saturday | Sunday | Monday | |
Tucson | 80 | 81 | 83 | 87 |
Phoenix | 81 | 80 | 84 | 89 |
Flagstaff | 56 | 63 | 65 | 67 |
Yuma | 78 | 80 | 85 | 90 |
Submit:
Your .cpp file (not zipped) from within the project folder
Screen shot (s) of your output
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