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
The aluminum rod (E1 = 68 GPa) is reinforced with the firmly bonded steel tube (E2 = 201 GPa). The diameter of the aluminum rod
Vsevolod [243]

Answer:

Explanation:

From the information given:

E_1 = 68 \ GPa \\ \\ E_2 = 201 \ GPa  \\ \\ d = 25 \ mm \  \\ \\ D = 45 \ mm \ \\ \\ L   = 761 \ mm  \\ \\ P = -88 kN

The total load is distributed across both the rod and tube:

P = P_1+P_2 --- (1)

Since this is a composite column; the elongation of both aluminum rod & steel tube is equal.

\delta_1=\delta_2

\dfrac{P_1L}{A_1E_1}= \dfrac{P_2L}{A_2E_2}

\dfrac{P_1 \times 0.761}{(\dfrac{\pi}{4}\times .0025^2 ) \times 68\times 10^4}= \dfrac{P_2\times 0.761}{(\dfrac{\pi}{4}\times (0.045^2-0.025^2))\times 201 \times 10^9}

P_1(2.27984775\times 10^{-8}) = P_2(3.44326686\times 10^{-9})

P_2 = \dfrac{ (2.27984775\times 10^{-8}) P_1}{(3.44326686\times 10^{-9})}

P_2 = 6.6212 \ P_1

Replace P_2 into equation (1)

P= P_1 + 6.6212 \ P_1\\ \\ P= 7.6212\ P_1 \\ \\  -88 = 7.6212 \ P_1  \\ \\ P_1 = \dfrac{-88}{7.6212} \\ \\  P_1 = -11.547 \ kN

Finally, to determine the normal stress in aluminum rod:

\sigma _1 = \dfrac{P_1}{A_1} \\ \\  \sigma _1 = \dfrac{-11.547 \times 10^3}{\dfrac{\pi}{4} \times 25^2}

\sigma_1 = - 23.523 \ MPa}

Thus, the normal stress = 23.523 MPa in compression.

8 0
3 years ago
You are the project manager assigned to construct a new 10-story office building. You are trying to estimate the costs for this
Semmy [17]

Answer:

Bottom-up Estimation

Explanation:

Bottom-up estimation is a type of project cost estimation that considers the cost of individual project activities and finally sums them up or finds the aggregates. The summation gives an idea of what the entire project will cost.

This is an effective way of estimating the cost of a project as it evaluates the costs on a wholistic basis. It also considers the tiniest details during the estimation process. The process moves from the simpler details to the more complicated details.

8 0
3 years ago
What is the composition, in atom percent, of an alloy that consists of 4.5 wt% Pb and 95.5 wt% Sn?
jeka57 [31]

Answer: Option A is correct -- 2.6 at% Pb and 97.4 at% Sn.

Explanation:

Option A is the only correct option -- 2.6 at% Pb and 97.4 at% Sn. While option B, which is 7.6 at% Pb and 92.4 at% Sn. and option C, which is 97.4 at% Pb and 2.6 at% Sn. and option D, which is 92.4 at% Pb and 7.6 at% Sn. are wrong.

6 0
4 years ago
Many farms and ranches use electric fences to keep animals from getting into or out of specific pastures. When switched on, an e
Nikolay [14]

Answer:

Aluminum

Explanation:

The best material to use when creating an electric fence would be Aluminum. Aluminum wiring is incredibly durable and can be easily obtained. Since aluminum is a non-magnetic metal its conducting capabilities far exceed other metallic options in the market and is also why companies choose aluminum for their high tension cable wiring. Aside from being more expensive than other feasible options its durability and conducting capabilities make it easily the best option.

7 0
3 years ago
Read 2 more answers
A horizontal pipe has an abrupt expansion from D1 5 8 cm to D2 5 16 cm. The water velocity in the smaller section is 10 m/s and
anyanavicka [17]
  • Answer:  Explanation:  Application of the bernoulli's equation comes in from conservation of mass flow.  The cross sectional area of the two pipes are calculated. from A = πD²/4 The velocity of water from conservation of mass flow is also calculated ; V2 = Ac1V1/Ac2 The Loss coefficient is then calculated from KL = (1 - Ac1²/Ac2²)² Then the head Loss (hL) is calculated  The detailed calculated and appropriate steps is as shown in the attached files.

5 0
3 years ago
Other questions:
  • Consider a cylindrical specimen of some hypothetical metal alloy that has a diameter of 11.0 mm. A tensile force of 1550 N produ
    7·1 answer
  • What kind of energy transformation happens when a boy uses energy from a sandwich to run a race​
    11·2 answers
  • A rectangular channel 2 m wide carries 3 m3 /s of water at a depth of 1.2 m. If an obstruction 40 cm wide is placed in the middl
    12·1 answer
  • What are some advantages of generating electrical energy from tides instead of from fossil fuels
    13·1 answer
  • If a particle moving in a circular path of radius 5 m has a velocity function v = 4t2 m/s, what is the magnitude of its total ac
    15·2 answers
  • Describing Tasks for Stationary Engineers Click this link to view O*NET’s Tasks section for Stationary Engineers. Note that comm
    12·2 answers
  • Which type of modeling can create virtual designs that can save clients thousands of dollars?
    9·1 answer
  • The primary energy source for the controller in a typical control system is either brainlythe primary energy source for the cont
    10·1 answer
  • Estimate the maximum expected thermal conductivity for a Cermet that contains 58 vol% titanium carbide (TiC) particles in a coba
    8·1 answer
  • In a typical American building, most modern lighting systems must use what voltage?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!