
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
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:](https://content.bartleby.com/qna-images/question/73d56bd1-f009-4d14-a4d0-3395051db284/37e279cf-ace5-4411-9883-30c06dd35d47/wp1su8_thumbnail.png)
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 nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- Programming Language: C++ Please use the resources included and provide notes for understanding. Thanks in advance. Code two functions to fill an array with the names of every World Series-winning team from 1903 to 2020, then output each World Series winner with the number of times the team won the championship as well as the years they won them. The input file is attached, along with the main function and screenprint. Please note team names that include two words, such as Red Sox, have an underscore in place of the space. This enables you to use the extraction operator with a single string variable. The following resources are included: Here is main. #include <iostream>#include <fstream>#include<string> using namespace std; // Add function declarations and documentation here void fill(string teams[], int size);void findWinner(string teams[], int size); int main(){ const int SIZE = 118;int lastIndex;string team[SIZE]; fill(team, SIZE);findWinner(team, SIZE); return…arrow_forwardthe language is c++ the bold is the user input , code asks the user what the width and height of the array should be using arrays and loops for this codearrow_forwardStudent Number, Grade 101029383,90 192736611,10 109800384,0 292833315,80 Complete the function below. If a line is long, you may write it in multiple lines at one blank, but please only write a single statement. def write_final_grades (assignment_grades: Dict, resubmit_grades: Dict, fname: str) -> None: """Write final marks to a final grade file named fname. assignment_grades maps student numbers to grades for the original assignment submission. resubmit_grades maps student numbers to grades for the resubmission of the same assignment. The resubmit penalty of 20% has not been applied within resubmit_grades. The higher mark, after resubmit penalties are applied, is the final mark for a student. Assume that the same student IDs are in both dictionaries. Assuming "grades.txt" is the original grade file shown (on the previous page) and "resubmit.txt" is the file above this function header: >>> original = make_dictionary ("grades.txt") >>> resubmit = make_dictionary ("resubmit.txt") >>>…arrow_forward
- Please answer this question in 10 mins I will upvote your answer. Create a structure called student that has fields for name, student id, age, score, and grade. The field name is a char array, student id is an integer, age is an integer, score is a float, grade is a character. The maximum value of a score is 100.00 and you should assign a grade to each student based on their scores. Based on user input n, enter the student details of n students, and display their details. You should also report the mean score of the students and report the number of students for each grade (for e.g.: No of students who secured A+: 5, No of students who secured A:4arrow_forwardC++ Programmingarrow_forwardpython: numpy def purchases(transactions): """ QUESTION 7 - A high-end store is trying to evaluate the total amount that customer's spend per transaction. They want customers to spend anywhere between $130 and $150 on average. - You need to determine whether the average number spent on each transaction per month is above, between, or below the desired amount. - Transactions is a numpy array containing a date, total amount earned each month, and total number of transactions each month. - Above: month's average amount spent per transaction > 150 - Within Range: 150 >= month's average amount spent per transaction >= 130 - Below: month's average amount spent per transaction < 130 - Return a numpy array with "Above", "Within Range" and "Below" for the average amount spent per transaction per month - THIS MUST BE DONE IN ONE LINE HINT: use np.where() and convert the type of each column to float Args: transactions…arrow_forward
- Assume you have declared an integer array named salary that contains exactly five elements. Using C++ programming language, Write a single statement to assign the value 25000 to the third element of this arrayarrow_forwardTrue or False Before you can use the structure to store data, you must create an instance of the structure in memory.arrow_forwardC# program in Visual Studio Code. I need to be able to enter five integer values and then have the Unique values entered display. Private member variable to store 5 unique values (hint: use an Array or a List) Public function to get 5 unique values from the user and store them in the member variable loop to get the numbers, if a number is already stored, ignore it and keep looping until you have 5 unique numbers if a number is out of range, don't store the value, throw an exception and handle it in such a way that you don't break the loop but do message the user that the value was out of rangearrow_forward
- Program language C: I need to display three columns named a, b, and c. There can be 12 rows.arrow_forwardA data structure in which all elements have the same type is called an ______arrow_forwardText-based adventure game: Pretend you are creating a text-based adventure game. At different points in the game, you want the user to select to fight, run, or hide from certain enemies. Modify the application below (week3.py) so that the selection variable is sent as an argument into the choice() function. The user should enter 1 to fight, 2 to run, or 3 to hide in the main(). The choice() function should print one of the three options. You will need to add an if statement in the choice() function to make the correct selection.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

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