Rainfall Statistics
Write a program that lets the user enter the total rainfall for
each of 12 months (starting with January) into an array of doubles.
The program should calculate and display (in this order):
Months should be expressed as English names for months in the
Gregorian calendar, i.e.: January, February, March, April, May,
June, July, August, September, October, November, December.
Input Validation: Do not accept negative numbers
for monthly rainfall figures. When a negative value is entered, the
program outputs "invalid data (negative rainfall) -- retry" and
attempts to reread the value.
NOTE: Decimal values should be displayed using default precision, i.e. do not specify precision.
SAMPLE RUN #1: ./ETest
Make sure it will run with the correct output. Ty!
Screenshot of the code:

Sample
Output:

Code to copy:
#include <iostream>
#include <string>
using namespace std;
int main()
{
//An array of strings is initialized.
//The months are stored in the memory allocated to the string //array: months
string months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
//initialize an array to store the rainfall of 12 months
double rainfall[12] = {-1};
//initialize a variable to store total rainfal
double total_rainfall = 0;
//initialize the variable min_rainfall to store the minimum rainfall
int min_rainfall = 0;
//initialize the variable max_rainfall to store the maximum rainfall
int max_rainfall = 0;
//Prompt the user to enter the rainfall for 12 months one by one.
for(int i = 0; i < 12; ++i)
{
cout << "Enter rainfall for " << months[i] << ": ";
cin >> rainfall[i];
//If the monthly rainfall figures are in negative numbers, the program outputs /invalid data. The value is re-read.
while(rainfall[i] < 0)
{
cout << "Invalid data (Negative rainfall) -- retry" << endl;
cout << "Enter rainfall for " << months[i] << ": ";
cin >> rainfall[i];
}
//The value of total rainfall is calculated
total_rainfall += rainfall[i];
//Calculate the minimum rainfall.
if(rainfall[i] < rainfall[min_rainfall])
{
min_rainfall = i;
}
//Calculate the maximum rainfall
else if(rainfall[i] > rainfall[max_rainfall])
{
max_rainfall = i;
}
}
//Print total rainfall
cout << "Total rainfall: " << total_rainfall << endl;
//calculate the average rainfall
double average_rainfall = total_rainfall / 12.0;
//Print average rainfall
cout << "Average rainfall: " << average_rainfall << endl;
//Print the month which has recorded minimum rainfall
cout << "Least rainfall in: " << months[min_rainfall] << endl;
//Print the month which has recorded maximum rainfall
cout << "Most rainfall in:" << months[max_rainfall] << endl;
}
Rainfall Statistics Write a program that lets the user enter the total rainfall for each of...
Write a program in C++ that lets the user enter the total rainfall for each of 12 months into an array of doubles. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Input validation: Do not accept negative numbers for monthly rainfall figures.
Write a program that lets the user enter the total amount of money spent on a credit card for each of 12 months into an array of doubles. The program should calculate and display the total amount of money spent for the year, the average monthly spent, and the months with the highest and lowest amounts. Input Validation: Do not accept negative numbers for monthly credit card charges. If the credit card charge for the month is negative, assume the...
Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amount. PLEASE MODULARIZED THE CODE PLEASE USE C PROGRAMMING AND ADD PSEUDOCODE
The Problem Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, the number of months above and below the average rainfall, and the highest rainfall for each quarter of the year. The Assignment Write a Java program that contains five method/functions as follows: main(). Calls the functions enterRain, rainStats, aboveBelow, and quarterlyRain. enterRain(). Uses...
Write a Python program that allows the user to enter the total rainfall for each of 12 months into a list. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest rainfall amounts. Data: January: 8.9 inches February: 11.1 inches March: 13.4 inches April: 6.9 inches May: 8.7 inches June: 9.1 inches July: 15.9 inches August: 4.4 inches September: 3.1 inches October: 5.6 inches November: 7.8...
Write a C++ console application that allows your user to capture rainfall statistics. Your program should contain an array of 12 doubles for the rainfall values as well as a parallel array containing the names of the months. Using each of the month names, prompt your user for the total rainfall for that month. The program should validate user input by guarding against rainfall values that are less than zero. After all 12 entries have been made, the program should...
C++ Weight Statistics Write a program that monitors monthly weight loss each of 12 months into an array of doubles. The program should calculate and display the total weight loss for the year, the average monthly weight loss, and the months with the highest and lowest amounts. Input Validation: Do not accept negative numbers for monthly weight loss. Write your code here: Use the Snipping Tool to show output
In Java language: Write a rainfall class that stores the total rainfall for each of 12 months of years 2015 -2017 into an 2D array of doubles. Use the text file at Actividades/Tareas link as input of rainfall data. The program should read the input data from a text file. The program should have methods that at least return the following: • Total rainfall for the years 2015 – 2017 - return a 1D array • The average monthly rainfall...
Directions: Write a code for the following programming exercise in PYTHON!!!!!!! -Design a program that lets the user enter the total rainfall for each of 12 months into a list. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Here is what i got so far, but for some reason this code only print the Minimum and Maximum. its not printing the Average. def...
Write a program that scores the total rainfall for each of 12 months into an array double. A sample array definition is shown below double thisYear[] = {1.6, 2.1, 1.7, 3.5, 2.6, 3.7, 3.9, 2.6, 2.9, 4.3, 2.4, 3.7}; The program should have the four functions to calculate the following 1. The total rainfall for the year 2. The average monthly rainfall 3. The month with most rain 4. The month with least rain Output: What to deliver? Your .cpp...