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]
4 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]4 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
Cavitation in pump assemblies can be avoided by decreasing tank pressure. a)-True b)-False
IgorLugansk [536]

Answer:

a) True

Explanation:

Cavitation in a pump occurs when the pressure of the liquid inside the pump suction is less than the vapour pressure at the suction. And also when the pump discharge pressure is extremely high.

Therefore cavitation in the pump assemblies can be avoided by decreasing the tank pressure because discharge cavitation takes place when the pressure at the pump discharge is extremely high.  High pressure at the discharge end of the pump prevents the water from flowing easily out, thereby recirculating the water within the pump which causes cavitation. So when the tank pressure is low, the pump discharge pressure will be low thus avoiding cavitation.

7 0
3 years ago
Does the Diesel engine have engine knock or detonation problem? Why?
Luda [366]

Explanation:

Yes Diesel engine have problem of knocking.

We know that knocking is phenomenon in which suddenly large amount of power generates this large amount of power will cause the failure of diesel engine.

Actually when one set of fuel inject inside the cylinder to burn with already compressed air (in general up to 10-15 bar) then this fuel does not burn complete and accumulate inside the cylinder.After that second set of fuel inject inside the cylinder then that one set of fuel burns with second set of fuel and produces large amount of sudden power for engine and causes the breaks in the crank or connecting rod of engine.it leads to damage the engine.

6 0
3 years ago
Someone please help me with this I’m stuck on it ?!i don’t have a lot of time
Kitty [74]
Python, Ruby, JavaScript, Java, and C++
6 0
3 years ago
_______is defined as the use of statistical techniques to control a process or production method
Wittaler [7]

Answer:

Statistical process control

Explanation:

The answer for the given blank is "Statistical process control".

The Statistical process control is the method that is applied by the employs to control the quality of the process and also, to monitor and control the process.

The Statistical process control helps in ensuring the efficiency of the process and ensuring the waste production is less.

8 0
4 years ago
The critical resolved shear stress for a metal is 39 MPa. Determine the maximum possible yield strength (in MPa) for a single cr
damaskus [11]

Answer:

78 MPa

Explanation:

Given that the critical resolved shear stress for a metal is 39 MPa, the maximum possible yield strength for a single crystal of this metal is twice the critical resolved shear stress for the metal. The maximum yield yield strength for a single crystal of this metal that is pulled in tension (\sigma_y) is given as:

\sigma_y=2*critical\ resolved\ shear\ stress(\tau_{css})\\\\\sigma_y=2*\tau_{css}\\\\\sigma_y=2*39\\\\\sigma_y=78\ MPa

4 0
3 years ago
Other questions:
  • 9. How is the Air Delivery temperature controlled during A/C operation?
    9·1 answer
  • 3. Consider a 10-m-long smooth rectangular tube, with a = 50 mm and b=25 mm, that is maintained at a constant surface temperatur
    5·1 answer
  • The efficiency of an electric motor is 80%. If it supplies 6 kW of rotational output power, calculate the amount of electrical i
    8·1 answer
  • What are atomic bombs made out of <br> Just wondering
    10·1 answer
  • Differentiate between pulser switch and data switch
    8·1 answer
  • Can some one help me on this?
    7·1 answer
  • PLLLLLEEESSSEEE IIII NEED ASAP
    12·2 answers
  • Need help tryna get a good grade
    9·2 answers
  • When could you use the engineering design process in your own life?
    9·1 answer
  • A segment of a roadway has a free flow speed of 45 mph and a jam density of 25 ft per vehicle. Determine the maximum flow and at
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!