Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, the program will keep track of the amount of rainfall for a 12-month period. The data must be stored in an array

In this assignment, the program will keep track of the amount of rainfall for a 12-month period. The data must be stored in an array of 12 doubles, each element of the array corresponds to one of the months. The program should make use of a second array of 12 strings, which will have the names of the months. These two arrays will be working in parallel. The array holding the month names will be initialized when the array is created using an initialization list (could also be created as an array of constants). The second array will hold doubles which will be the total rainfall for each month. Using a function, the program will prompt the user for the rainfall for each month (using both arrays) and store the value entered into the array with the rainfall totals; the other is used to display which month the program is asking for the rainfall total.

The output of the program will display the following once the data is all entered:

  • The total rainfall for the year
  • The average monthly rainfall
  • The month with the highest amount of rainfall (must display the month as a string)
  • The month with the lowest amount of rainfall (must display the month as a string)

The program must have the following functions:

  • void CollectRainData(double [ ], string [ ], int);
    • Gets the user input for the rain totals for each month
    • Parameters array for rainfail totals, array of month names and size of arrays
  • double CalculateTotalRainfall(double [ ], int);
    • Calculates the total rainfall from the array parameter.
  • double CalculateAverage(double, int);
    • Calculates the Average rainfall
    • First parameter is the total rainfall, second is number of months
  • double FindLowest(double [ ], int, int&);
    • Finds the month with the lowest amount of rainfall, returns this value
    • Provides the index of the lowest month in the last parameter.
  • double FindHighest(double [ ], int, int&);
    • Finds the month with the highest amount of rainfall, returns this value
    • Provides the index of the highest month in the last parameter.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

What is a verb?

Answered: 1 week ago