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
A full-adder is a combinational circuit that forms the arithmetic sum of three input bits.
Vinvika [58]
(b) correct it is false
5 0
2 years ago
Who can use NIST resources?
sukhopar [10]

Answer:

Federal agencies

Explanation:

NIST (National Institute of Standards and Technology) also called between 1901 and 1988 National Bureau of Standards (NBS), it is an agency of the Technology Administration of the United States Department of Commerce. The mission of this institute is to promote innovation and industrial competition in the United States through advances in metrology, standards and technology in ways that improve economic stability and quality of life.

As part of this mission, NIST scientists and engineers continually refine the science of measurement (metrology) by creating precise engineering and manufacturing required for most current technological advances. They are also directly involved in the development and testing of standards made by the private sector and government agencies. The NIST was originally called the National Bureau of Standards (NBS), a name it had from 1901 to 1988. The progress and technological innovation of the United States depends on the abilities of the NIST, especially if we talk about four areas: biotechnology , nanotechnology, information technologies and advanced manufacturing.

7 0
3 years ago
Consider the velocity boundary layer profile for flow over u flat plate to be of the form u = C_1 + C_2 y. Applying appropriate
ra1l [238]

Answer:

The  result in terms of the local Reynolds number ⇒ Re = [μ_∞ · x] / v

Explanation:

See below my full workings so you can compare the results with those obtained from the exact solution.

4 0
3 years ago
Witch truck company is better.<br><br> Ram <br> Ford <br> Toyoda<br> GMC
arlik [135]
Ram is the better truck company
7 0
3 years ago
Read 2 more answers
Solve the questions in the picture
STatiana [176]
15x -/c/ fb is the answer
6 0
2 years ago
Other questions:
  • An excavation is at risk for cave-in and water accumulation because of the excess soil that has accumulated. What type of excava
    12·1 answer
  • Consider flow in between two parallel plates located a distance H from each other. Fluid flow is driven by the bottom plate movi
    15·1 answer
  • In a cellular phone system, a mobile phone must be paged to receive a phone call. However, paging attempts don’t always succeed
    11·1 answer
  • Determine the combined moment about O due to the weight of the mailbox and the cross member AB. The mailbox weighs 3.2 lb and th
    14·1 answer
  • Build a 32-bit accumulator circuit. The circuit features a control signal inc and enable input en. If en is 1 and inc is 1, the
    13·1 answer
  • The annual average of solar photovoltaic energy in Phoenix is 6,720
    8·1 answer
  • Determine the minimum required wire radius assuming a factor of safety of 3 and a yield strength of 1500 MPa.
    15·1 answer
  • Estimate (a) the maximum, and (b) the minimum thermal conductivity values (in W/m-K) for a cermet that contains 76 vol% carbide
    9·1 answer
  • Please answer i dont understand and dont know the answer​
    14·1 answer
  • Almost all collisions are due to driver error
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!