1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
yuradex [85]
3 years ago
15

Modify the Rainfall Statistics program you wrote for Programming Challenge 2 of Chapter 7 . The program should display a list of

months, sorted in order of rainfall, from highest to lowest.
Engineering
1 answer:
rjkz [21]3 years ago
8 0

Answer:

#include<iostream>

#include <iomanip>

using namespace std;

const int NUM_MONTHS = 12;

double getTotal(double [], int);

double getAverage(double [], int);

double getLargest(double [], int, int &);

double getSmallest(double [], int, int &);

double getTotal(int rainFall,double NUM_MONTHS[])

{

double total = 0;

for (int count = 0; count < NUM_MONTH; count++)

total += NUM_MONTH[count];

return total;

}

double getAverage(int rainFall,double NUM_MONTH[])

{getTotal(rainFall,NUM_MONTH)

average= total/NUM_MONTHS;

return average;

}

double getHighest(int rainFall, double NUM_MONTHS[]) //I left out the subScript peice as I was not sure how to procede with that;

{

double largest;

largest = NUM_MONTHS[0];

for ( int month = 1; month <= NUM_MONTHS; month++ ){

                     if ( values[month] > largest ){

                 largest = values[month];

return largest;

          }

double getSmallest(int rainFall, double NUM_MONTHS[])

{

double smallest;

smallest = NUM_MONTHS[0];

for ( int month = 1; month <= NUM_MONTHS; month){

                     if ( values[month] < smallest ){

                 smallest = values[month];

return smallest;

          }

 

int main()

{

double rainFall[NUM_MONTHS];

 for (int month = 0; month < NUM_MONTHS; month++)

  {

     cout << "Enter the rainfall (in inches) for month #";

     cout << (month + 1) << ": ";

     cin >> rainFall[month];

 

     while (rainFall[month] < 0)

     {

      cout << "Rainfall must be 0 or more.\n"

             << "Please re-enter: ";

      cin >> rainFall[month];

     }

  }

  cout << fixed << showpoint << setprecision(2) << endl;

  cout << "The total rainfall for the year is ";

  cout << getTotal(rainFall, NUM_MONTHS)

      << " inches." << endl;

   cout << "The average rainfall for the year is ";

  cout << getAverage(rainFall, NUM_MONTHS)

      << " inches." << endl;

   int subScript;

cout << "The largest amount of rainfall was ";

  cout << getLargest(rainFall, NUM_MONTHS, subScript)

      << " inches in month ";

  cout << (subScript + 1) << "." << endl;

  cout << "The smallest amount of rainfall was ";

  cout << getSmallest(rainFall, NUM_MONTHS, subScript)

      << " inches in month ";

  cout << (subScript + 1) << "." << endl << endl;

  return 0;

}

You might be interested in
Design a calculator circuit which can perform either addition or subtraction on a 4-digit binary input and generate a 5-digit bi
uysha [10]

Answer: See attachment below

Explanation:

7 0
3 years ago
1. You use
lorasvet [3.4K]
4-ways tell me if I’m wrong
4 0
3 years ago
What are materials engineers trying to discover when they study different materials?
coldgirl [10]
What do materials science and engineering graduates do?
Almost two-thirds of materials science graduates are in employment six months after graduation.

The skills developed during a materials science degree allow graduates enter a range of sectors, including working as engineering professionals and in design and marketing roles.

Destination Percentage
Employed 60.4
Further study 24.5
Working and studying 5.1
Unemployed 4
Other 6.1
Graduate destinations for materials science and engineering
Type of work Percentage
Engineering and building 23.9
Marketing, PR and sales 11.9
Business, HR and financial 11.7
Technicians and other professionals 10
Other 42.5
5 0
2 years ago
Read 2 more answers
In the idealized Otto cycle, heat is added during: a. Isentropic Compression b. Constant (minimum) volume c. Constant (maximum)
docker41 [41]

Answer:

(b) Constant (minimum) volume

Explanation:

In the idealized Otto cycle there are 4 process that are

  • Reversible adiabatic compression  
  • Addition of heat at constant volume
  • Reversible adiabatic expansion
  • Rejection of constant volume

So from above discussion we can see that heat is added when there is constant (minimum) volume which is given in option (b) so option (b) will be the correct answer

3 0
3 years ago
Pls help with this pls /what point of view is used to tell Steve Jobs: The Man Who Thought Different?
Digiron [165]

Answer:

In the case of Steve Jobs: The Man Who Thought Different, the author Karen Blumenthal tells his biography by using his name and "he" pronouns. For example, the opening sentence says "Steve Jobs's first story involved connecting dots, and it began with a most unusual promise". Therefore, the point of view used to tell this story is the third person.

Explanation:

6 0
2 years ago
Other questions:
  • Now, suppose that you have a balanced stereo signal in which the left and right channels have the same voltage amplitude, 500 mV
    8·1 answer
  • Solve the compound inequality. 3x − 4 &gt; 5 or 1 − 2x ≥ 7
    8·1 answer
  • A block is sliding on a level surface of varying materials, and so its effective coefficient of friction is variable, 0.1t, wher
    6·1 answer
  • What is the main role of matrix in composites! a)-to transfer stress to the other phases b)- to protect phases from environment
    7·1 answer
  • A refrigerator has a cooling load of 50 kW. It has a COP of 2. It is run by a heat engine which consumes 50 kW of heat to supply
    12·1 answer
  • Summarize three attributes that are important for an engineer to possess.
    13·1 answer
  • A horizontal curve of a two-lane undivided highway (12-foot lanes) has a radius of 678 feet to the center line of the roadway. A
    8·1 answer
  • (20 points) A 1 mm diameter tube is connected to the bottom of a container filled with water to a height of 2 cm from the bottom
    12·1 answer
  • Software that is released to have users test out the "bugs" is known as Ransomeware O Break-in software 2 O Flim flam software O
    15·1 answer
  • Could you please answer this question clearly?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!