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
Ket [755]
4 years ago
8

Assignment Ahead of an expected drought this winter, the National Weather Service would like you to write a program that records

the rainfall totals for 5 California cities and calculates a some statistics on the data. They would like to use your program in their branch offices across the state, so it needs to be able to accept rainfall data for any 5 cities, specified by the user. Using values stored in arrays, write a program that does the following: 1. Prompts the user for the names of 5 California cities. You can use any 5 cities of your choosing. Here are some to help you get started: (note that some cities have spaces in their names, this should be allowed). 2. Prompts the user in a loop) to enter rainfall totals (in inches, as a decimal number) for each of the 5 cities. Validate the input so the rainfall must be re-entered if it is less than zero or greater than 100. 3. Using 3 value-returning functions, calculate the locations with the highest and lowest rainfall and the average rainfall across the 5 cities. 4. Output the 3 calculated values with a precision of 2 digits past the decimal point.
Engineering
1 answer:
Marat540 [252]4 years ago
6 0

Answer:

#include "stdafx.h"

#include <string>

#include <iostream>

#include <iomanip> //setprecision and fixed is located in this namespace

using namespace std;

const int Max = 5;

string Cities[Max];

double CitiesRainfall[Max];

int getIndexOfLowest(double[], int);

int getIndexOfHighest(double[], int);

double getAverage(double[], int);

void Menu();

void InputCities();

void InputCitiesRainfall();

void PrintOutput();

int main()

{

  InputCities();

  InputCitiesRainfall();

  PrintOutput();

  system("pause");

  return 0;

}

void InputCities()

{

  bool loop = false;

  for (int i = 0; i < Max; i++)

  {

      string city;

      do

      {

          cout << "Please enter city #" << i + 1 << ": ";

          getline(cin, city);

          if (city == "")

          {

              cout << "City cannot be empty!" << endl;

              loop = true;

          }

          else

          {

              loop = false;

          }

      } while (loop);

      Cities[i] = city;

  }

}

void InputCitiesRainfall()

{

  bool loop = false;

  for (int i = 0; i < Max; i++)

  {

      double rainfallTotal;

      do

      {

          cout << "Please enter the rainfall total for " << Cities[i] << ": ";

          cin >> rainfallTotal;

          if (rainfallTotal<0 || rainfallTotal>100)

          {

              cout << "Rainfall must be greater than 0 or less than 100." << endl;

              loop = true;

          }

          else

          {

              loop = false;

          }

      } while (loop);

      CitiesRainfall[i] = rainfallTotal;

  }

}

int getIndexOfLowest(double arr[], int size)

{

  int index = 0;

  int lowest = arr[0];

  for (int i = 0; i<Max; i++)

  {

      if (lowest>arr[i])

      {

          lowest = arr[i];

          index = i;

      }

  }

  return index;

}

int getIndexOfHighest(double arr[], int size)

{

  int index = 0;

  int highest = arr[0];

  for (int i = 0; i < Max; i++)

  {

      if (highest < arr[i])

      {

          highest = arr[i];

          index = i;

      }

  }

  return index;

}

double getAverage(double arr[], int size)

{

  double avg, total;

  avg = total = 0;

  for (int i = 0; i < Max; i++)

  {

      total += arr[i];

  }

  avg = total / size;

  return avg;

}

void PrintOutput()

{

  int highestRainfallIndex = getIndexOfHighest(CitiesRainfall, Max);

  cout << "The city with the highest rainfall is " << Cities[highestRainfallIndex] << "." << endl;

  int lowestRainfallIndex = getIndexOfLowest(CitiesRainfall, Max);

  cout << "The city with the lowest rainfall is " << Cities[lowestRainfallIndex] << "." << endl;

  cout << "The average rainfall across all cities is " << setprecision(2) << fixed << getAverage(CitiesRainfall, Max) << " inches." << endl;

}

Explanation:

You might be interested in
How can the use of local materials improve the standard of living of Filipinos?
Rudiy27
Choose a quality one, and don't use it as necessary
7 0
2 years ago
Investigative personalities prefer to work with:
Andrews [41]

Answer:

Its data

Explanation:

just took the assignment on edge 2021

5 0
3 years ago
A 75 mm diameter, 15 mm wide A80-M12V grinding wheel is used for traverse surface grinding of a 75 mm by 75 mm 1040 steel workpi
Dmitrij [34]

Answer:

Detailed solution is given and calculations are done

3 0
3 years ago
4.54 Saturated liquid nitrogen at 600 kPa enters a boiler at a rate of 0.008 kg/s and exits as saturated vapor (see Fig. P4.54).
solmaris [256]

Answer:

hello the figure attached to your question is missing attached below is the missing diagram

answer :

i) 1.347 kW

ii) 1.6192 kW

Explanation:

Attached below is the detailed solution to the problem above

First step : Calculate for Enthalpy

h1 - hf = -3909.9 kJ/kg ( For saturated liquid nitrogen at 600 kPa )

h2- hg = -222.5 kJ/kg ( For saturated vapor nitrogen at 600 kPa )

second step : Calculate the rate of heat transfer in boiler

Q1-2 = m( h2 - h1 )  = 0.008( -222.5 -(-390.9) = 1.347 kW

step 3 : find the enthalpy of superheated Nitrogen at 600 Kpa and 280 K

from the super heated Nitrogen table

h3 = -20.1 kJ/kg

step 4 : calculate the rate of heat transfer in the super heater

Q2-3 = m ( h3 - h2 )

        = 0.008 ( -20.1 -(-222.5 ) = 1.6192 kW

6 0
3 years ago
According to Moore and Marra's (2005) case study, which observed two online courses, students in the first course implemented a
Archy [21]

Your question is incomplete, please let me assume this to be your complete question;

ORIGINAL SOURCE:

When instructors are creating discussion board activities for online courses, at least two questions must be answered. First, what is the objective of the discussions? Different objectives might be to create a "social presence" among students so that they do not feel isolated, to ask questions regarding assignments or topics, or to determine if students understand a topic by having them analyze and evaluate contextual situations. Based on the response to this question, different rules might be implemented to focus on the quality of the interaction more so than the quantity. The second question is, how important is online discussions in comparison to the other activities that students will perform? This question alludes to the amount of participation that instructors expect from students in online discussions along with the other required activities for the course. If a small percentage of student effort is designated for class participation, our results show that it can affect the quality and quantity of interactions.

References:

Moore, J. L., & Marra, R. M. (2005) A comparative analysis of online discussion participation protocols.Journal of Research on Technology in Education, 38(2), 191-212.

STUDENT VERSION:

According to Moore and Marra's (2005) case study, which observed two online courses, students in the first course implemented a constructive argumentation approach while students in second course had less structure for their postings. As they stated, when instructors create online discussion board activities, they must answer at least two questions. These questions are: "What is the objective of the discussions?" And "How important are online discussions in comparison to the other activities that students will perform?". According to their findings, the discussion activities that were designed based on the answers to these questions can influence the quality and quantity of interactions (Moore & Marra, 2005).

References:

Moore, J. L., & Marra, R. M. (2005) A comparative analysis of online discussion participation protocols.Journal of Research on Technology in Education, 38(2), 191-212.

Which of the following is true for the students work;

Word-for-word plagiarism

Paraphrasing plagiarism

Not Plagiarism

ANSWER: IT IS NOT PLAGIARISM

Explanation: plagiarism is the act of extracting knowledge from someone's literature work, without acknowledging the literature work. In other words, this can be called a theft of knowledge, because when you failed to acknowledge the literature source that helped you to produce your paper work, it means you have claimed to be the original owner of that knowledge.

This is not a Plagiarism because the student has acknowledged the source of the knowledge in it's literature work. The original source and the student has cited the same literature work, this why their work looks similar but not exactly the same. So the student has not committed Plagiarism

4 0
4 years ago
Other questions:
  • The weight of a liter of oil that has a specific gravity 0.83 is a) 3.0 N b) 8.1 N c)0.18N d) 18.0 N e) None of these
    7·1 answer
  • Use the drop-down menus to choose the correct term or words to complete the statements.
    10·1 answer
  • True/False<br> An anemometer displays wind direction, wind speed, altitude and type of precipitation
    12·1 answer
  • What is a engineer ?
    15·2 answers
  • At many intersections, under certain circumstances, a right turn may be made while the traffic light is red. Before turning righ
    14·1 answer
  • Which of the following is not a step in a building’s life cycle?
    6·1 answer
  • 7 to 1 inch above the stock
    5·1 answer
  • 10. Which one of the following items would you expect to find on a floor framing plan?
    6·2 answers
  • At what distance from the Earth’s surface is a 10,000 kg satellite if its potential energy is equal to –5.58 x 1011 J? (choose t
    5·1 answer
  • Select three types of variables scientists use in experiments.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!