Rainfall StatisticsWrite 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): the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts.   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.

Question

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):



  • the total rainfall for the year,
  • the average monthly rainfall,
  • and the months with the highest and lowest amounts.

 


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.

Expert Answer

Want to see the step-by-step answer?

See Answer

Check out a sample Q&A here.

Want to see this answer and more?

Step-by-step answers are written by subject experts who are available 24/7. Questions are typically answered in as fast as 30 minutes.*

See Answer
*Response times vary by subject and question complexity. Median response time is 34 minutes and may be longer for new subjects.
Tagged in
EngineeringComputer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A

Q: Assume that a computer architect has already designed 6 two-address and 24 zero-address instructions...

A: Given:Instruction length = 11 bits = 211 = 2048 bitsAddress register size = 4 bits5 two-address inst...

Q: Construct an npda corresponding to the grammar S→aABB|aAA,A→aBB|b,B→bBB|A.

A: Firstly, we will convert the given grammar into GNFS → aABB|aAAA → aBB|bB → bBB|aBB|a

Q: How to implement a pluggable Adapter design pattern in Java?

A: Let’s say we have a client class called Client.java which calls method1( ) of an existing library cl...

Q: Find regular grammars for the following languages on {a, b}: L = {w : na (w) and nb (w) are both eve...

A: Regular grammar for the language L = {W: na (w) and nb (w) are both even} is as follows:

Q: Find and list the websites of the parent and child standardization organizations that create standar...

A: Standards in Data communication and computer networking defines the rules which are needed for inter...

Q: Construct a dfa that accepts the language generated by the grammar S → abA, A → baB, B → aA|bb.

A: Deterministic finite automata (DFA):

Q: 12 4x)x,is an another form of representation of fuzzy set. A, (x) /x, is an another form of represen...

A: A fuzzy set is a pair X, m(A)) where X is a Universal set and mA) is a membership function or degree...

Q: Write a program that contains 2 methods, main and printLine (10 points)1) The printLine method will ...

A: Declare required variables ‘first’, ‘second’ and ‘times’ which is used to store first character, sec...

Q: C++ Thanks!Example:"apple"->NULLreturn "apple"->NULL"apple"->"apple"->NULLreturn "apple"...

A: So in the fisrt step we will make the current node value is head.node* current = head;