Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Spring 2017 CMSC 140 Programming Project 6: Rainfall Statistics Concepts tested in this project Draw a foschatand Reading data from a file into arrays Processing

image text in transcribed
image text in transcribed
Spring 2017 CMSC 140 Programming Project 6: Rainfall Statistics Concepts tested in this project Draw a foschatand Reading data from a file into arrays Processing parallel arrays Writing array data to files - write a coda in e+t - Passing arrays to functions Processing arrays using functions - Project Description Write a program that will calculate and display on a file the total rainfall for the year, the average monthly rainfall, the months with the highest and lowest amounts, and the months with rainfalls of 4 inches or more Project Specifications Input for this project has two sources. The rainfalls for each month beginning with January and ending with December are read, in order, from an input file. The user must enter: the names of the input and output files. Output also has two sources. The program title and the programmer name should appear on both the console and the file. If the input file does not open, an error message should appear on the console. The message "Processing complete" should appear on the console just before the main program ends (make it the last statement before "return;"). The file output shows the months and associated rainfalls as well as the calculated and summary results. Use two parallel arrays in the main function for this project. The names of the months should use an initialization list and the rainfalls will be stored in an array of doubles. The arrays will be passed as parameters. (NO GLOBAL VARIABLES-a global constant of 12 is fine.) Assume that the file contains exactly 12 lines of input and is constructed correctly. Output to the file will be handled by the main function. Assume that a rainfall of exactly 4 inches will be stored as 4.0 (not 3.9999 ). Create functions for the following: 1. Read the rainfalls: Prompt for and get the input file name and try to open the file. If the file opens, read the rainfalls from the file, store them into the array, and return 0. If the file does not open, print an error message on the console and return -1. If the file is not found, do NOT process the rainfalls or attempt to write to the output file. parameter parameter. parameter 2. Calculate and return the total of rainfall array elements. The rainfall array should be a 3. Find and return the subscript of the highest rainfall amount. The rainfall array should be a 4. Find and return the subscript of the lowest rainfall amount. The rainfall array should bea

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_2

Step: 3

blur-text-image_3

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

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions

Question

Describe Balor method and give the chemical reaction.

Answered: 1 week ago

Question

How to prepare washing soda from common salt?

Answered: 1 week ago

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago