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
Would be much appreciated if someone could help with this will give brainiest.
Mashcka [7]

Answer:   both mm and inches on each dimension in a sketch (with the main dimension in one format and the other in brackets below it), in the way you can have dual dimensions shown when detailing an idw view.

personally think it would look a mess/cluttered with even more text all over the sketch environment, but everyone's differenent.

If it's any help - you know you can enter dimensions in either format?  If you're working in mm you can still dimension a line and type "2in" and vice-versa.  Probably know this already, but no harm saying it, just in case.

You can enter the units directly in or mm and Inventor will convert to current document settings (which  you can change - maybe someone can come up with a simple toggle icon to toggle the document settings).  Tools>Document Settings>Units

Unlike SolidWorks when you edit the dimension the original entry shows in the dialog box so it makes it easy to keep track of different units even if they aren't always displayed.  (SWx does the conversion or equation and then that is what you get.)

I work quite a bit in inch and metric and combination (ex metric frame motor on inch machine) and it doesn't seem to be a real difficulty to me.

4 0
3 years ago
What type of companies would employ in mechanics engineering​
Alex73 [517]
What do y’all do when ya girl go eat lunch and eat it and eat
3 0
3 years ago
A train consists of a 50 Mg engine and three cars, each having a mass of 30 Mg . If it takes 75 s for the train to increase its
ohaa [14]

Answer:

T = 15 kN

F = 23.33 kN

Explanation:

Given the data in the question,

We apply the impulse momentum principle on the total system,

mv₁ + ∑\int\limits^{t2}_{t1} {Fx} \, dt = mv₂

we substitute

[50 + 3(30)]×10³ × 0 + FΔt = [50 + 3(30)]×10³ ×  ( 45 × 1000 / 3600 )  

F( 75 - 0 ) =  1.75 × 10⁶

The resultant frictional tractive force F is will then be;

F =  1.75 × 10⁶ / 75

F = 23333.33 N

F = 23.33 kN

Applying the impulse momentum principle on the three cars;

mv₁ + ∑\int\limits^{t2}_{t1} {Fx} \, dt = mv₂

[3(30)]×10³ × 0 + FΔt = [3(30)]×10³ ×  ( 45 × 1000 / 3600 )  

F(75-0) = 1.125 × 10⁶

The force T developed is then;

T =  1.125 × 10⁶ / 75

T = 15000 N

T = 15 kN

7 0
3 years ago
A three-point bending test is performed on a glass specimen having a rectangular cross section of height d = 5.4 mm (0.21 in.) a
Fudgin [204]

Answer:

5.21e-2mm

Explanation:

Please see attachment

8 0
3 years ago
What are the factors that influence the power input to the compressor?
Lena [83]

Answer:

option e is correct answer

5 0
2 years ago
Other questions:
  • Methane and oxygen react in the presence of a catalyst to form formaldehyde. In a parallel reaction, methane is oxidized to carb
    12·1 answer
  • A lake with constant volume 1.1 x 10^6 m^3 is fed by a stream with a non-conservative pollutant of 2.3 mg/L and flow rate 35 m^3
    14·1 answer
  • Chemical materials that are transported are called..
    8·1 answer
  • The goal of the Concept Selection phase is to (please choose the best answer): Group of answer choices
    10·1 answer
  • When -iron is subjected to an atmosphere of hydrogen gas, the concentration of hydrogen in the iron, CH (in weight percent), is
    5·1 answer
  • Describe the make-up of an internal combustion engine.<br> Pls answer quickly.
    5·1 answer
  • What is the reading of this Dial Caliper?
    9·1 answer
  • PLEASE HELP ME RIGHT NOW!!
    11·1 answer
  • The complexity of bfs and dfs
    11·1 answer
  • I need your help to answer in the picture plss help me!​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!