Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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. The code is supposed to read from a tsv from NYC Open Data Current Reservoir Levels called Current_Reservoir_Levels.tsv from year 2018. The code below is a skeleton.

Example:

$ ./compare Enter starting date: 09/13/2018 Enter ending date: 09/17/2018 09/13/2018 East 09/14/2018 East 09/15/2018 East 09/16/2018 East 09/17/2018 East
#include  #include  #include  #include  using namespace std; int main( ){ ifstream fin("Current_Reservoir_Levels.tsv"); if (fin.fail()) { cerr << "File cannot be opened for reading." << endl; exit(1); } string junk; getline(fin, junk); string date, user_input; double eastSt, eastEl, westSt, westEl; cout << "Enter a date: "; cin >> user_input; while(fin >> date >> eastSt >> eastEl >> westSt >> westEl) { fin.ignore(INT_MAX, ' '); if(date == user_input){ cout << "East basin storage: " << " " << eastSt << endl; } } }

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 For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions