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
What is the braks mean effictive pressure?
OverLord2011 [107]

Engine cylinder pressure

<u>Explanation:</u>

  1. Brake mean effective pressure is a method to calculate  the engine cylinder pressure which  would give the measured brake horsepower. Brake mean effective pressure is used to identify engine efficiency regardless of capacity or engine speed.
  2. It is used to identify engine efficiency.It is measured by means of transducers or pressure gauges.
  3. It is the measure of engine capacity to do work.

7 0
3 years ago
How does the "E" in STEM work with the other letters
KIM [24]

Answer:

if you are speaking of the acronym then Engineering uses science and mathematics to solve everyday problems in society

4 0
3 years ago
A person is planning a bungee jump from a 40 meter high bridge. Under the bridge is a river with crocodiles, so the person does
Nonamiya [84]

Answer:

a. l = 19.7m, b. 18.55m, c. Impact Force = 3889.84 N

Explanation:

The total energy of the system when the person is at top of the bridge is

Potential energy = mgh, Kinetic energy = 0

The total energy of the  system when the person reaches just above the surface

Potential energy = 0, Kinetic energy = 0, Spring energy = ½ K X2, where k is the spring constant and X is the deflection

Applying conservation of energy

mgh = 0 + 0 + ½ K X²

80 x 9.81 x 40 = ½ (3600/l) X²

31392 = ½ (3600/l) X²

We can also conclude that

l+ X + 1.75 = 40

l + X = 38.25

a. <u>Substitute the value of x from above into the energy conversion expression</u>

31392 = ½ (3600/l)(38.25 - l)²

31392 x 2/3600 = (38.25 + l² – 2l(38.25))/l

17.44l = l2 – 76.5l + 38.25²

l² – 76.5l – 17.44l +1463.0625 = 0

Solving for l we get

L = 19.7

Hence, length of the rope is 19.7m

b. <u>The deflection is calculated by using the relation between l and X</u>

L + X = 38.25

X = 38.25 – 19.7 = 18.55m

c. <u>The impact force is calculated using the impact force formula which relates the impact force with the deflection</u>

F = KX

F = (3600/l) . X

F = (3600/19.7) . (18.55) = 3889.84 N

Thus, the impact force is 3889.84 N

3 0
3 years ago
If particleboard is used as wall sheathing, the grade mark with type _____ or _____ should be stamped on it.
kramer

If particleboard is used as wall sheathing, the grade mark with type M1 or M2 should be stamped on it.

<h3>What is particle board?</h3>

Particle board is notably used as floors underlayment or as a base for parquet floors, timber floors, or for carpets. For this purpose, the particle forums are dealt with with unique chemical compounds and resins to cause them to water-resistant or termite proof.

Waferboard, OSB, and composite plywood, while carried out as wall sheathing, offer a nail base for software of shingle siding.

Read more about the sheathing:

brainly.com/question/5029827

#SPJ1

8 0
2 years ago
A power of 100 kW (105 W) is delivered to the other side of a city by a pair of power lines, between which the voltage is 12,000
OLga [1]

Answer:

I = 8.3 Amp

potential drop = 83 V

Explanation:

Power = 100 KW

V = 12,000 V

R = 10 ohms

a)

Calculate current I in each wire:

P = I*V

I = P / V

I = 100 / 12 = 8.333 A

b)

Calculate potential drop in each wire:

V = I*R

V = (8.3) * (10)

V = 83 V

4 0
3 years ago
Other questions:
  • A gas stream contains 4.0 mol % NH3 and its ammonia content is reduced to 0.5 mol % in a packed absorption tower at 293 K and 10
    14·1 answer
  • 1. Consider a city of 10 square kilometers. A macro cellular system design divides the city up into square cells of 1 square kil
    10·1 answer
  • The advantages of solar cells include all of the following, except a.moderate net energy yield b.little or no direct emissions o
    11·1 answer
  • The water behind Hoover Dam is 206m higher than the Colorado river below it. At what rate must water pass through the hydraulic
    15·2 answers
  • Each cout statement has a syntax error. Type the first cout statement, and press Run to observe the error message. Fix the error
    11·1 answer
  • A mass of air occupying a volume of 0.15m^3 at 3.5 bar and 150 °C is allowed [13] to expand isentropically to 1.05 bar. Its enth
    11·1 answer
  • The following median grain size data were obtained during isothermal liquid phase sintering of an 82W-8Mo-8Ni-2Fe alloy. What is
    15·1 answer
  • A cold air standard gas turbine engine with a thermal efficiency of 56.9 % has a minimum pressure of 100 kP
    8·1 answer
  • Which of the eight diagnostic steps for locating an engine performance problem is performed first?
    10·1 answer
  • One reason the shuttle turns on its back after liftoff is to give the pilot a view of the horizon. Why might this be useful?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!