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
By using a book of the OHS Act, Act 85 of 1993, find the act or regulation where the following extraction comes from "every empl
AnnyKZ [126]

Answer:

Is very important to employ safety and care

For every staff

Is very necessary is protected

Her is going very high stage

Because of every one say that this company is best for others company

Is reason safety is very important in our life

<h3 /><h3><em>I hope</em><em> </em><em>you like</em><em> </em><em>it</em><em> </em></h3>

3 0
3 years ago
What are the steps to execute an instruction by cpu?What is the function of DMA controller.
JulijaS [17]

Explanation:

1. A sequence of instructions is stored in memory.

2. The memory address wherever the first instruction is found is copied to the instruction pointer.

3. The CPU sends the address within the instruction pointer to memory on the address bus.

4. The CPU sends a “read” signal to the control bus.

5. Memory responds by sending a copy of the state of the bits at that memory location on the

data bus, that the CPU then copies into its instruction register.

6. The instruction pointer is automatically incremented to contain the address of the next

instruction in memory.

7. The CPU executes the instruction within the instruction register.

8. Go to step 3

Steps 3, 4, and 5 are called an instruction fetch. Notice that steps 3 – 8 constitute a cycle, the instruction execution cycle. It is shown graphically below.

A DMA controller can generate memory addresses and initiate memory read or write cycles. It contains several hardware registers that can be written and read by the CPU. These include a memory address register, a byte count register, and one or more control registers.

4 0
3 years ago
According to the eNotes, a program that eliminates sales and promotions in an effort to minimize the bullwhip effect would be ca
Ilia_Sergeevich [38]

Options: True or false

Answer:True, it will be called CRMWRONGEDLP.

Explanation:eNotes was founded in 1998 by Brad Satoris and Alexander Bloomingdale, to enable and enhance the ability of students to solve assignments as given and other home works,eNote is also used by students to prepare effectively and efficiently for examinations.

Since its launch eNote has been a great source of educational materials for students who have gained a lot in the use of its materials.

bullwhip effect is a concept in supply chain, where forcasts causes the supply chain to be inefficient, it usually starts from retailers who raise concern of high demands.

CRMWRONGEDLP, is the program that minimizes the bullwhip effects according to eNote.

7 0
3 years ago
Three bars each made of different materials are connected together and placed between two walls when the temperature is 12 oC. D
slega [8]

Answer:

F = 9.11 x 10³ N = 9.11 KN

Explanation:

The areas, lengths, young's modulus, and coefficient of linear thermal expansion are given in the diagram. First we find the equivalent change in length due to temperature change:

ΔL = (ΔL)steel + (ΔL)brass + (ΔL)Copper

ΔL = (∝s)(Ls)(ΔT) + (∝b)(Lb)(ΔT) + (∝c)(Lc)(ΔT)

where,

ΔL = Equivalent Change in Length = ?

ΔT = Change in Temperature = 25°C - 12°C = 13°C

Ls = Length of Steel Segment = 300 mm = 0.3 m

Lb = Length of Brass Segment = 200 mm = 0.2 m

Lc = Length of Copper Segment = 100 mm = 0.1 m

Therefore,

ΔL = (12 x 10⁻⁶ °C⁻¹)(0.3 m)(13 °C) + (21 x 10⁻⁶ °C⁻¹)(0.2 m)(13 °C) + (17 x 10⁻⁶ °C⁻¹)(0.1 m)(13 °C)

ΔL = 46.8 x 10⁻⁶ m + 54.6 x 10⁻⁶ m + 22.1 x 10⁻⁶ m

ΔL = 123.5 x 10⁻⁶ m   ----------------------- equation (1)

Now, we calculate this deflection in terms of an applied force (F):

ΔL = (F)(Ls)/(Es)(As) + (F)(Lb)/(Eb)(Ab) + (F)(Lc)/(Ec)(Ac)

ΔL = (F)(0.3 m)/(200 x 10⁹ Pa)(200 x 10⁻⁶ m²) + (F)(0.2 m)/(100 x 10⁹ Pa)(450 x 10⁻⁶ m²) + (F)(0.1 m)/(120 x 10⁹ Pa)(515 x 10⁻⁶ m²)

ΔL = F(7.5 x 10⁻⁹ m/N + 4.44 x 10⁻⁹ m/N + 1.61 x 10⁻⁹ m/N)

ΔL = F(13.55 x 10⁻⁹ m/N)   --------------------- equation (1)

Comparing equation (1) and equation (2):

123.5 x 10⁻⁶ m = F(13.55 x 10⁻⁹ m/N)

F = (123.5 x 10⁻⁶ m)/(13.55 x 10⁻⁹ m/N)

<u>F = 9.11 x 10³ N = 9.11 KN</u>

6 0
3 years ago
How to calculate effective resistance​
denis23 [38]

Answer:

For a circuit with resistances R1 and R2 in series or in parallel as in Figure 2, the effective resistance can be calculated by using the following rules. Rab = R1 + R2.

Explanation:

4 0
3 years ago
Other questions:
  • To reduce the drag coefficient and thus improve the fuel efficiency of cars,the design of side rearview mirrors has changed dram
    11·1 answer
  • Eagletrons are all-electric automobiles produced by Mogul Motors, Inc. One of the concerns of Mogul Motors is that the Eagletron
    5·1 answer
  • Which of the following is not an example of heat generation? a)- Exothermic chemical reaction in a solid b)- Endothermic Chemica
    15·1 answer
  • Which of these cars traveled faster during time interval <br> please show solution
    13·1 answer
  • Given a two-dimensional steady inviscid air flow field with no body forces described by the velocity field given below. Assuming
    8·1 answer
  • Write a C program that will update a bank balance. A user cannot withdraw an amount ofmoney that is more than the current balanc
    13·1 answer
  • Which phase of project development provides engineers with an opportunity to determine the gaps or problems of the project on pa
    14·1 answer
  • 15 POINTS! Help.
    9·2 answers
  • Consider a car manufacturing firm, with more than 100 facilities worldwide. What would be the positive aspects of having high nu
    15·2 answers
  • How many hours must be traveled by car for each hour of rock climbing to make the
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!