Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles . The program

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.

SAMPLE RUN #1: ./ETest

Interactive Session Input File: _stdin Output File: _stderr (empty) Output File: _stdout Hide Invisibles

Highlight: NoneStandard Input OnlyPrompts OnlyStandard Output w/o PromptsFull Standard OutputAllShow Highlighted Only

EnterrainfallforJanuary:1

EnterrainfallforFebruary:2

EnterrainfallforMarch:3

EnterrainfallforApril:4

EnterrainfallforMay:5

EnterrainfallforJune:6

EnterrainfallforJuly:7

EnterrainfallforAugust:8

EnterrainfallforSeptember:9

EnterrainfallforOctober:10

EnterrainfallforNovember:11

EnterrainfallforDecember:12

Totalrainfall:78

Averagerainfall:6.5

Leastrainfallin:January

Mostrainfallin:December

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions