Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the date from NYC Open Data Current Reservoir Levels. Filter date between January 1, 2016 and December 31, 2016 Task B. Minimum and maximum

Using the date from NYC Open Data Current Reservoir Levels.

Filter date between January 1, 2016 and December 31, 2016

Task B. Minimum and maximum storage in 2016

Write a program minmax.cpp that finds the minimum and maximum storage in East basin in 2016.

Example (using made up numbers):

$ ./minmax minimum storage in East basin: 61.13 billion gallons MAXimum storage in East basin: 69.22 billion gallons 

Hint:

The program should read the file line by line, while keeping track of what is the highest and the lowest storage level in the basin so far. In the end, after reading the entire file, the found values will be the minimum and the maximum storage levels for the entire year.

Task C. Comparing elevations

Write a program compare.cpp that asks the user to input two dates (the beginning and the end of the interval). The program should check each day in the interval and report which basin had higher elevation on that day by printing East or West, or print Equal if both basins are at the same level.

Example:

$ ./compare Enter starting date: 09/13/2016 Enter ending date: 09/17/2016 09/13/2016 East 09/14/2016 East 09/15/2016 Equal 09/16/2016 West 09/17/2016 West 

Explanation:

Date East (ft) West (ft)
09/13/2016 576.28 575.93 East is higher
09/14/2016 576.06 575.79 East is higher
09/15/2016 575.75 575.75 Equal elevation
09/16/2016 575.51 575.61 West is higher
09/17/2016 575.32 575.4 West is higher

Task D. Reverse chronological order

image text in transcribed

Write a program reverse-order.cpp which asks the user to input two dates (earlier date then later date). The program should report the West basin elevation for all days in the interval in the reverse chronological order (from the later date to the earlier).

Example:

$ ./reverse-order Enter earlier date: 05/29/2016 Enter later date: 06/02/2016 06/02/2016 587.66 ft 06/01/2016 587.81 ft 05/31/2016 587.93 ft 05/30/2016 588.02 ft 05/29/2016 588.17 ft 

Hint: If for the previous tasks you did not use arrays, here you really have to read the data into arrays first, and only then report them in the required order.

3 1 8

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions