Write a program weather.cpp that uses a structure to store the following weather data for a particular quarter: • Total Rainfall Low Temperature • High Temperature Average Temperature (average of low and high temperature) The program should have an array of structures with a size of four (4) to hold weather data for an entire year. When the program runs, it should ask the user to enter data for each quarter. Once the data are entered for all the quarters, the program should calculate and display the average quarter rainfall, the total rainfall for the year, the highest and lowest temperatures for the year (and the quarter they occurred in), and the average of all the quarterly average temperatures. Input validation: Only accept temperatures within the range between -100 and + 140 degrees Fahrenheit, and the low temperature must not be higher than the high temperature.
Write a program weather.cpp that uses a structure to store the following weather data for a particular quarter: • Total Rainfall Low Temperature • High Temperature Average Temperature (average of low and high temperature) The program should have an array of structures with a size of four (4) to hold weather data for an entire year. When the program runs, it should ask the user to enter data for each quarter. Once the data are entered for all the quarters, the program should calculate and display the average quarter rainfall, the total rainfall for the year, the highest and lowest temperatures for the year (and the quarter they occurred in), and the average of all the quarterly average temperatures. Input validation: Only accept temperatures within the range between -100 and + 140 degrees Fahrenheit, and the low temperature must not be higher than the high temperature.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![Instructions
Write a program weather.cpp that uses a structure to store the following weather data for a
particular quarter:
• Total Rainfall
Low Temperature
High Temperature
Average Temperature (average of low and high temperature)
The program should have an array of structures with a size of four (4) to hold weather data for an
entire year. When the program runs, it should ask the user to enter data for each quarter. Once
the data are entered for all the quarters, the program should calculate and display the average
quarter rainfall, the total rainfall for the year, the highest and lowest temperatures for the year
(and the quarter they occurred in), and the average of all the quarterly average temperatures.
Input validation: Only accept temperatures within the range between -100 and + 140 degrees
Fahrenheit, and the low temperature must not be higher than the high temperature.
Notes
• Validate temperatures within the range between -100 and + 140 degrees.
• Validate the low temperature must not be higher than the high temperature.
• You are encouraged to write the function to display the output results. Suggested function
prototype: void displayAverages (WeatherInfo year[], int nQuarter);
• You are encouraged to write the function to compute the lowest and highest temperatures and
their corresponding indexes of quarters (which will be called in displayAverages).
Suggested function prototype:](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F73d56bd1-f009-4d14-a4d0-3395051db284%2F37e279cf-ace5-4411-9883-30c06dd35d47%2Fwp1su8_processed.png&w=3840&q=75)
Transcribed Image Text:Instructions
Write a program weather.cpp that uses a structure to store the following weather data for a
particular quarter:
• Total Rainfall
Low Temperature
High Temperature
Average Temperature (average of low and high temperature)
The program should have an array of structures with a size of four (4) to hold weather data for an
entire year. When the program runs, it should ask the user to enter data for each quarter. Once
the data are entered for all the quarters, the program should calculate and display the average
quarter rainfall, the total rainfall for the year, the highest and lowest temperatures for the year
(and the quarter they occurred in), and the average of all the quarterly average temperatures.
Input validation: Only accept temperatures within the range between -100 and + 140 degrees
Fahrenheit, and the low temperature must not be higher than the high temperature.
Notes
• Validate temperatures within the range between -100 and + 140 degrees.
• Validate the low temperature must not be higher than the high temperature.
• You are encouraged to write the function to display the output results. Suggested function
prototype: void displayAverages (WeatherInfo year[], int nQuarter);
• You are encouraged to write the function to compute the lowest and highest temperatures and
their corresponding indexes of quarters (which will be called in displayAverages).
Suggested function prototype:

Transcribed Image Text:void computeMinMax (WeatherInfo year [), int nQuarter,
double& highest, double& lowest,
int& highQuarter, int& lowQuarter);
• Copy and paste your console outputs after the end of your source file. Remember to comment
the output with /* and */ or multiple //.
• Avoid cryptic variable names and poor indentations.
• Your code must compile using the IDE and compiler the instructor specifies. Any code that does
not compile and run in the environment specified by the instructor will get a zero.
Sample Output
Enter the total rainfall, low & high temperatures:
Quarter 1: 15 40 67
Quarter 2: 40 50 78
Quarter 3: 30 58 80
Quarter 4: 5 -110 85
ERROR: Temperature range: -100 through 140
Low temperature <= high temperature.
Please enter low and high temperatures again: 65 141
ERROR: Temperature range: -100 through 140
Low temperature <= high temperature.
Please enter low and high temperatures again: 140 65
ERROR: Temperature range: -100 through 140
Low temperature <= high temperature.
Please enter low and high temperatures again: 65 85
Total Rainfall: 90
Average Quarterly Rain: 22.5
Average Quarterly Average Temperature: 65.375
Highest Temperature: 85 (Quarter 4)
Lowest Temperature: 40 (Quarter 1)
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY