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
Maru [420]
2 years ago
7

In C++ please (read the image below for instructions)

Computers and Technology
1 answer:
FromTheMoon [43]2 years ago
8 0

Using the knowledge in computational language in C code  it is possible to write a code that  print the month name along with their rainfall inches. Then we have to calculate the total rainfall.

<h3>Writting the code:</h3>

<em>#include <bits/stdc++.h></em>

<em>using </em><em>namespace </em><em>std;</em>

<em />

<em>// function to print the rainfall of each month</em>

<em>void rainfallStatistics(string month[], double rainfall[]){</em>

<em>    </em>

<em>    double sum = 0; // variable to store the total sum of rainfall</em>

<em>    string maxMonth = month[0]; // variable to return month with maximum rainfall</em>

<em>    double </em><em>maxRainfall </em><em>= INT_MIN; // variable to store the maximum rainfall</em>

<em>    </em>

<em>    // running the loop till the last month</em>

<em>    for(int i=0; i<12; i++){</em>

<em>        </em>

<em>        // printing the month and rainfall</em>

<em>        cout<< month[i] << "           " << fixed << setprecision(2) << rainfall[i] << " inches" << endl;</em>

<em>        </em>

<em>        // storing the sum</em>

<em>        sum = sum + rainfall[i];</em>

<em>        </em>

<em>        // checking the month with highest rainfall</em>

<em>        if(rainfall[i] > </em><em>maxRainfall</em><em>){</em>

<em>            </em>

<em>            maxRainfall = rainfall[i];</em>

<em>            maxMonth = month[i];</em>

<em>        }</em>

<em>    }</em>

<em>    </em>

<em>    // calculating the average of the rainfall</em>

<em>    double average = sum / double(12);</em>

<em>    </em>

<em>    cout << endl;</em>

<em>    cout << "Total for the year " << sum << " inches" << endl;</em>

<em>    cout << "Average rainfall per month " << average << " inches" << endl;</em>

<em>    cout << "Month with the greatest rainfall was " << maxMonth << " with rainfall of " << </em><em>maxRainfall </em><em><< " inches" << endl;</em>

<em>    </em>

<em>}</em>

<em>// driver program</em>

<em>int main()</em>

<em>{</em>

<em>    // array to store the nonth name</em>

<em>    string month[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};</em>

<em>    </em>

<em>    // array to store the rainfall</em>

<em>    double rainfall1[12] = { 4.50, 4.25, 3.26, 1.35, 0.80, 0.20, 0.10, 0.00, 0.40, 1.20, 2.96, 4.71 };</em>

<em>    double rainfall2[12] = { 3.50, 1.25, 7.26, 8.35, 2.80, 0.00, 1.10, 4.00, 9.40, 2.20, 3.96, 4.71 };</em>

<em>    </em>

<em>    cout << "Hayward Statistics" << endl;</em>

<em>    cout << endl;</em>

<em>    cout<< "Month" << "         " << "Rainfall" << endl;</em>

<em>    </em>

<em>    // calling the function for Hayward</em>

<em>    </em><em>rainfallStatistics</em><em>(month, rainfall1);</em>

<em>    cout << endl;</em>

<em>    cout << endl;</em>

<em>    </em>

<em>    cout << "Houston Statistics" << endl;</em>

<em>    cout << endl;</em>

<em>    cout<< "Month" << "         " << "Rainfall" << endl;</em>

<em>    </em>

<em>    // calling the function for Houston</em>

<em>    rainfallStatistics(month, rainfall2);</em>

<em>    </em>

<em>    return 0;</em>

<em>}</em>

See more about c code at brainly.com/question/19705654

#SPJ1

You might be interested in
Why is it important for organizations to make strong commitment to Cloud at scale?
bogdanovich [222]

The reason why us crucial for organizations to make strong commitment to Cloud at scale is because organizations can transform by focusing solely on Cloud Tech.

This will help the company to drive business agility as well as  streamlining operations with reduce costs.

<h3>What is usefulness of cloud technology?</h3>

cloud technology helps the companies to scale as well as adapt at speed and accelerate innovation.

Learn more about cloud technology at;

brainly.com/question/9759640

3 0
3 years ago
Which cell address indicates the intersection of the first row and the first column in worksheet?
Rzqust [24]

Answer:

A. A1

Explanation:

Worksheet's Columns are named with Alphabets. i.e. A,B,C,D,E....

And Worksheet's rows are named with numbers. i.e. 1,2,3,4,5....

So the intersection of first row number as "1" and First Column name as "A" is A1 as worksheet displays column name first and then row number.

8 0
4 years ago
Read 2 more answers
Television is a technological development that occurred during the what age?
bearhunter [10]

Answer:

industrial age

Explanation:

5 0
3 years ago
Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn c
Alisiya [41]

Answer:

The Java code is given below

Explanation:

import java.util.*;

public class CensoredWords {

public static void main(String args[]) {

Scanner scnr=new Scanner(System.in);

String userInput;

System.out.println("Enter String: ");

userInput=scnr.nextLine();

int res=userInput.indexOf("darn");

if(res == - 1) {

System.out.println(userInput);

} else {

System.out.println("Censored");

}

}

}

8 0
3 years ago
What do you think would have happened if early explorers had not followed their maps, charts, and compasses? (Give 4 examples in
enyata [817]

Answer:

If the explorers wouldn’t have followed their maps they would have gotten lost. Another thing that might of happened is maybe they would find someplace cool but they have no idea where they are. Without a map most captains would have probably been going in circles for years. Imagine if you didn’t have a map, you probably would have thought you were going to fall of the side of the earth, because back then the explores thought the earth was flat.

Explanation:

:) ur welcome hope I helped

8 0
3 years ago
Other questions:
  • Where would be the most likely place to find the keyboard combination used to toggle a keyboard backlight on or off?
    8·1 answer
  • The encapsulation unit on the data link layer of the osi model is _________
    10·1 answer
  • What does ADF means????
    13·2 answers
  • What do computer viruses eat for snacks?
    7·2 answers
  • A ____ may be composed of a few individual objects or several complex groups of objects.
    9·1 answer
  • The find and
    10·1 answer
  • Why is know app downloading in my android phone even if I have 900 MB ???
    8·2 answers
  • What is computer system<br>explain the role of bank in computer<br>​
    15·2 answers
  • Which coding manual contains three to seven character codes with a decimal after the third character
    11·1 answer
  • Give 5 characteristics of bad capacitor<br> give 5 characteristics of good capacitor
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!