Question: the output needs to look like this and pulled from a csv file Number of data records: 941 Beginning date: 2015-01-13 Ending date: 2021-10-23 Maximum
the output needs to look like this and pulled from a csv file
Number of data records: 941 Beginning date: 2015-01-13 Ending date: 2021-10-23 Maximum temperature: 106 degrees on 2018-06-14 Minimum temperature: 13 degrees on 2020-01-24 Number of days 100 and over: 32 Number of days below freezing: 49
//DailyReading.cpp
/** * Implementation (Definition) of DailyReading class **/ #include "DailyReading.h"
/** * Constructor * @param max is the max temperature for this record **/ DailyReading::DailyReading(int max) { maxTemperature = max; }
/** * Report if the day's max temperature is greater than the * given reference temperature. * @param refTemp is the reference temperature to compare against * @return true if this day's max is greater than the reference temp **/ bool DailyReading::maxGreaterThan(int refTemp) { return maxTemperature > refTemp; }
/** * Return a string for reporting the maximum temperature. * @return a string containing the report **/ std::string DailyReading::maxOnDateString() { return std::to_string(maxTemperature) + std::string(" degrees on
//DailyReading.h
// // Declaration of DailyReading class // #ifndef DAILYREADING_H #define DAILYREADING_H #include
#include
class DailyReading { public: DailyReading(int max); bool maxGreaterThan(int refTemp); std::string maxOnDateString(); private: int maxTemperature; };
#endif // DAILYREADING_H
// main.cpp
/****************************************************************** * Weather data processing app, starting version ******************************************************************/ #include
// Helper function declarations; definitions are below main() void readDataFile(std::ifstream& inFile, std::vector
/** * Program start **/ int main(int argc, char* argv[]) { // check to make sure we have one command line argument if (argc != 2) { std::cerr << "Error: a filename argument must be given "; return -1; } // The collection of all of our daily readings that we read in // from the data file; we store the collection in a vector, // which acts as a list or kind-of like a variable-sized array std::vector
/** * Read in a weather data file and save the relevant data fields * in a collection (vector) of DailyReading objects * @param inFile is an open ifstream object to read the file from * @param dataset is collection to put the temperature readings into **/ void readDataFile(std::ifstream& inFile, std::vector
/** * An example of iterating over the dataset collection * and using each object (just to print out one message) * @param dataset is collection of temperature readings to use **/ void printDataset(std::vector
//weather-small.csv
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
