Purchase Solution

C++ Structure to Store the Weather Data

Not what you're looking for?

Ask Custom Question

Please I need the source.cpp code

Write a program that uses a structure to store the following weather date for a particular month:
Total Rainfall
High Temperature
Low Temperature
Average Temperature

The program should have an array of 12 structures to hold weather date for an entire year. When the program runs, it should ask the user to enter date for each month. (The average temperature should be calculated.) Once the date are entered for all the months, the program should calculate and display the average monthly rainfall, the total rainfall for the year, the highest and lowest temperatures for the year (and the months they occurred in), and the average of the monthly average temperatures.
Input validation: only accept temperatures within the range between -100 and +140 degrees Fahrenheit.

Below is how the code should look like.

Enter the following information:
Month 1
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 2
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 3
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 4
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 5
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 6
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 7
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 8
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 9
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 10
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 11
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 12
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Total Rainfall is:
Average Monthly Rain:
Average Monthly Average Temperature:
Highest Temperature:
Lowest Temperature:
Press any key to continue.........

Purchase this Solution

Solution Summary

This solution is in C++. Show a source program that uses a structure to store the weather data. It shows loops For & Do...While and Selection If statements.

Solution Preview

Dear Student,
I have included the code. I have used validation only ...

Solution provided by:
Education
  • BSc (Hons), University of Colombo - Sri Lanka
  • MEngSc, University of Melbourne
  • Certificate IV in Training & Assessment , Australian Business Council
Recent Feedback
  • "Thank you!"
  • "Thank you."
  • "Thanks a lot for you help and support"
  • "Sorry about the late payment but the assignment was sufficient and appreciated. Good work"
  • "Great description! Thank you for your quick response."
Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

C# variables and classes

This quiz contains questions about C# classes and variables.

Javscript Basics

Quiz on basics of javascript programming language.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.