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
For an Otto cycle, plot the cycle efficiency as a function of compression ratio from 4 to 16.
Elza [17]

Assumptions:

  • Steady state.
  • Air as working fluid.
  • Ideal gas.
  • Reversible process.
  • Ideal Otto Cycle.

Explanation:

Otto cycle is a thermodynamic cycle widely used in automobile engines, in which an amount of gas (air) experiences changes of pressure, temperature, volume, addition of heat, and removal of heat. The cycle is composed by (following the P-V diagram):

  • Intake <em>0-1</em>: the mass of working fluid is drawn into the piston at a constant pressure.
  • Adiabatic compression <em>1-2</em>: the mass of working fluid is compressed isentropically from State 1 to State 2 through compression ratio (r).

        r =\frac{V_1}{V_2}

  • Ignition 2-3: the volume remains constant while heat is added to the mass of gas.
  • Expansion 3-4: the working fluid does work on the piston due to the high pressure within it, thus the working fluid reaches the maximum volume through the compression ratio.

         r = \frac{V_4}{V_3} = \frac{V_1}{V_2}

  • Heat Rejection 4-1: heat is removed from the working fluid as the pressure drops instantaneously.
  • Exhaust 1-0: the working fluid is vented to the atmosphere.

If the system produces enough work, the automobile and its occupants will propel. On the other hand, the efficiency of the Otto Cycle is defined as follows:

           \eta = 1-(\frac{1}{r^{\gamma - 1} } )

where:

           \gamma = \frac{C_{p} }{C_{v}} : specific heat ratio

Ideal air is the working fluid, as stated before, for which its specific heat ratio can be considered constant.

           \gamma = 1.4

Answer:

See image attached.

5 0
3 years ago
Prefix version of 6600 volts​
GenaCL600 [577]

Answer:

6.6 kilo volts = 6.6 k volts

Explanation:

A prefix is a word, number or a letter that is added before another word. In physics we have different prefixes for the exponential powers of 10, that are placed before units in place of those powers. Some examples are:

deci (d)   ------  10⁻¹

centi (c)   ------  10⁻²

milli (m)   ------   10⁻³

kilo (k)     ------   10³

mega (M) -----   10⁶

giga (G)   ------   10⁹

We have:

6600 volts

converting to exponential form:

=> 6.6 x 10³ volts

Thus, we know that the prefix of kilo (k) is used for 10³.

Hence,

=> <u>6.6 kilo volts = 6.6 k volts</u>

7 0
3 years ago
The most important element of green construction is that it is a(n) __________ approach to building. *
madam [21]
Environmentally friendly


Since it focuses on are sustainable and efficient with and are made with the future in mind.
5 0
3 years ago
A cylindrical specimen of a hypothetical metal alloy is stressed in compression. If its original and final diameters are 16.403
Dmitry [639]

Answer:

A certain vehicle loses 3.5% of its value each year. If the vehicle has an initial value of $11,168, construct a model that represents the value of the vehicle after a certain number of years. Use your model to compute the value of the vehicle at the end of 6 years.

Explanation:

8 0
3 years ago
A long rod of 60-mm diameter and thermophysical properties rho= 8000 kg/m3, c= 500 J/kg·K, and k= 50 W/m·K is initially at a uni
Dvinal [7]

Answer:

Tc =    = 424.85 K

Explanation:

Data given:

D = 60 mm = 0.06 m

\rho = 8000 kg/m^3

k = 50 w/m . k

c = 500 j/kg.k

h_{\infty} = 1000 w/m^2

t_{\infity} = 750 k

t_w = 500 K

surface area = As = \pi dL

\frac{As}{L} = \pi D = \pi \timeS 0.06

HEAT FLOW Q  is

Q = h_{\infty} As (T_[\infty} - Tw)

 = 1000 \pi\times 0.06 (750-500)

  = 47123.88 w per unit length of rod

volumetric heat rate

q = \frac{Q}{LAs}

  = \frac{47123.88}{\frac{\pi}{4} D^2 \times 1}

q = 1.66\times 10^{7} w/m^3

Tc = \frac{- qR^2}{4K} + Tw

= \frac{ - 1.67\times 10^7 \times (\frac{0.06}{2})^2}{4\times 56} +  500

   = 424.85 K

7 0
3 years ago
Other questions:
  • 6. Staples are the most common item used to secure and support cables in residential wiring.​
    14·1 answer
  • The solid cylinders AB and BC are bonded together at B and are attached to fixed supports at A and C. The modulus of rigidity is
    6·1 answer
  • Need answers for these please ​
    15·1 answer
  • Consider laminar, fully developed flow in a channel of constant surface temperature Ts. For a given mass flow rate and channel l
    15·1 answer
  • Mobility refers to the ability to?
    12·1 answer
  • The current through a 10-mH inductor is 10e−t∕2 A. Find the voltage and the power at t = 8 s.
    15·2 answers
  • Everfi futuresmart module 6 retirement pie chart
    5·2 answers
  • What are the main causes of injuries when using forklifts?
    5·1 answer
  • What is an advantage of a nuclear-fission reactor?.
    11·1 answer
  • The project's criteria.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!