Question: For this assignment you will write a program that reads in climate data (imagine it is coming from a weather station) and stores that data
For this assignment you will write a program that reads in climate data (imagine it is coming from a weather station) and stores that data in a linked list. After reading and storing all of the data your program will generate a report from the data.
The objective of this assignment is to learn how to implement a linked list and to gain familiarity with using a linked list in solving a problem. Since one of the objectives is to learn how to implement a linked list you cannot use the STL linked list.
Your program should use good design methodologies so you should have separate classes for each of the following:
- datalogger -- This class represents the "business logic" of adding data to the storage. This class also handles filtering out duplicate data items (see the requirements listed below). This is the only class that weatherlog.cpp knows about and it expects two methods: addData() and printReport(). - linkedlist -- This class should implement a linked list. This class should be distinct from the datalogger class (although I would expect datalogger to have a data member that is a linkedlist object). - weatherdata -- This class encapsulates the weather data (time, temperature, windspeed).
You are welcome to create any additional classes that you need.
Below are the specific external and internal requirements for this assignment. Your program will be evaluated based on these requirements.
== External Requirements ==
- The main driver (weatherlog.cpp) will provide a sequence of data readings. The program needs to store these readings. After all of the data is read in, the program must create a report identical to the one in the expected.txt output file. - Data with a duplicate timestamp indicates contradictory or inaccurate data and should not be stored (all records with the same timestamp). - The report includes: - a line that states the timestamp range - a line that states the number of data entries - a temperature section that contains a detailed report (see below) - a windspeed section that contains a detailed report (see below) - detailed report data: - the minumum value measured - the maximum value measured - a list of all of the readings >= the 99% reading (in order) - a list of all of the readings <= the 1% reading (in order) - see the provided "expected.txt" to see the report format
== Internal Requirements ==
- The program must use the supplied weatherlog.cpp file, unmodified, as the main driver. - All of the weather data must be stored in a linked list. - The linked list must have three separate "chains". One that keeps the data ordered by timestamp, one that keeps the data ordered by temperature, and one that keeps the data ordered by windspeed. - Strings must be stored using char* variables, not std::string. - No memory leaks.
Weatherlog.cpp file:
#include
using namespace std;
int main(int argc, char** argv) {
datalogger dl;
if (argc != 2) { cout << "Usage: " << argv[0] << "
// Read the data
char* datafile = argv[1]; ifstream infile(datafile); int timestamp; double temperature; double windspeed;
while (!infile.eof()) { infile >> timestamp; infile >> temperature; infile >> windspeed;
if (!infile.eof()) { dl.addData(timestamp, temperature, windspeed); } }
// Output the report dl.printReport();
return(0); }
Example Climate data values in climatedata.txt:
1480906168 -226 361 1480906168 -224 270 1480906175 -222 326 1480906179 -218 236 1480906187 -218 145 1480906189 -216 109 1480906189 -212 145 1480906190 -208 153 1480906197 -204 90 1480906197 -201 48 1480906198 -197 38 1480906203 -193 60 1480906209 -190 117 1480906213 -188 108 1480906219 -186 104 1480906225 -185 94 1480906225 -181 186 1480906233 -181 234 1480906240 -179 221 1480906246 -175 283 1480906253 -175 224 1480906260 -177 146 1480906261 -180 126 1480906261 -184 51 1480906262 -185 38 1480906271 -187 52 1480906273 -191 25 1480906277 -193 110 1480906279 -194 42 1480906280 -197 0 1480906284 -199 0 1480906291 -203 0 1480906293 -205 0 1480906295 -208 0 1480906302 -209 0 1480906309 -210 0 1480906312 -213 0 1480906320 -209 0 1480906323 -206 41 1480906330 -202 102 1480906331 -202 130 1480906339 -202 114 1480906341 -200 165 1480906344 -196 256 1480906348 -192 299 1480906349 -191 205 1480906349 -190 176 1480906354 -186 206 1480906359 -184 189 1480906367 -183 258 1480906376 -180 310 1480906383 -177 282 1480906386 -175 286 1480906392 -175 266 1480906400 -175 240 1480906403 -174 217 1480906404 -170 12
This question has been asked before, http://www.chegg.com/homework-help/questions-and-answers/programming-assignment-assignment-write-program-reads-climate-data-imagine-coming-weather--q22881915. But was done incorrectly. There needs to be atleast 7 total files, weatherlog.cpp, datalogger.cpp, datalogger.h, linkedlist.cpp, linkedlist.h, weatherdata.cpp and weatherdata.h. Please take as long as you need to fully complete everything, as the previous post did not.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
