Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following program, write the code in C++, please do it well, make sure you show all steps and how you did it. Please make

The following program, write the code in C++, please do it well, make sure you show all steps and how you did it. Please make the code such that I can copy paste it. Also please show the output as well, as sometimes the code is given but there is not a correct output, so show a screenshot of your output and that it matches everything asked in the question.

The following might be alittle confusing as there is many files, makefiles etc, make sure for each specific file I mention in the directions you say what file it is, whether it be

"reservoir.cpp", "get_east_storage" function etcc. Make sure everything properly runs and all the different files combined are able to produce the desired outcome. Make sure each file and its code is specified. Please follow all directions well:

Before the task gets introduced you have to do the following:

In the assignment, you are writing a code on data of Ashokan water levels

The instructions on how to go to the data set and what to do in the data set is the following:

image text in transcribed

For the website to find the current reservoir levels it is data of city new york reservoir levels, it will be found in the data set section.

Now for the formatting of the data before we get into lab instructions it is the following:

image text in transcribed

image text in transcribed

Now that the data part of the code is done and how you lead into the problem, this is the problem itself that you have to do

image text in transcribed

Now while this is the main step, you also have to add these following files and put the codes for them for this problem for the addition part of this code:

For this lab, you will create a program with multiple files and us make to control compilation. There will be a sample Makefile along with other starter files in this repo.

In addition,

image text in transcribed

Please read all the directions and do all of the above well. Make sure to open and download the data set, use it to make all the files, the code, and the cpp files and make sure all the code and output are correct. Make sure all the codes you sent are correct and all of them run together as well.

I understand this is very complicated, but please do your best and leave a comment if you need something.

In this lab, we will be studying the Ashokan water levels for the year 2018. It is available from NYC Open Data. Please follow these instructions to download the dataset: 1. Follow the link NYC Open Data Current Reservoir Levels. 2. Choose the View Data menu option (it will reload the page). 3. Filter data including only the year 2018. To do that: - Click the blue button Filter - In its submenu Filter, click Add a New Filter Condition - Choose Date is between January 1, 2018 and December 31, 2018 4. Sort entries by Date in the Ascending order. 5. Export the data: - Click the light blue button Export - Choose TSV for Excel (it will produce a plain text data file in tab-separated values format). - Save obtained file Current_Reservoir_Levels.tsv on your hard drive. Don't open the datafile in Excel (that can mess up its formatting). Instead, you can open it with your text editor (gedit). The datafile is a plain text file whose first line is a header followed by rows of data. The entries in each row are separated by the tab symbol, hence the name of the file format: TSV (tab-separatedvalues). It is the most convenient format for reading by our C++ program. Each row has five fields: Date, Storage (in billions of gallons) and Elevation (in feet) for the East basin and for the West basin of the reservoir: To read the datafile, we have to open an input file stream (represented by an object of type ifstream, here we called it fin ): ifstream f in( "Current_Reservoir_Levels.tsv"); if (fin.fail()) cerr "File cannot be opened for reading." endl; exit(1); / exit if failed to open the file \} Remember that the first line in the file is a header line. We have to skip it before we get to process the actual data. We can do that by reading that line into a temporary variable that we can call junk : string junk; // new string variable getline(fin, junk); // read one line from the file After that, the file can be read line by line. The most idiomatic C++ way to read such well-formatted file until the end would be the following: Here, variable can be of type string, and the others are numeric variables of type extracting the storage and elevation in East and West basins. After you are done reading the file, close the stream: fin.close(); Need to include additional header files The above code is using a new function and a stream class make them work, we have to include two new headers at the beginning of the program: Write a program east-storage.cpp that asks the user to input a string representing the date (in MM/DD/YYYY format), and prints out the East basin storage on that day. Example $. /east-storage Enter date: 05/20/2018 East basin storage: 80.96 billion gallons Write a program that consists of two .cpp files plus any supporting files. One will be named main. cpp and it will drive your program. It will contain the main function. The other file should be named reservoir.cpp and should contain a function with the prototype double get_east_storage(std::string date). The function should accept a std::string specifying a date and should return the East Basin storage for that day. Your program should call and test this function from main. There should be no keyboard input but the output should illustrate that the function works correctly. Note: This assignment template contains a skeleton that includes the Makefile, main.cpp, and reservoir.h and reservoir.cpp. You are expected to fill in the functions and calls. Note: The get_east_storage function should open and read the data file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions