Download a temperature data fromhere(Links to an external site.)orhere(Links to an external site.). Those are the daily average temperature data at each city from 1995~present. There are four columns:...

1 answer below »


  • Download a temperature data fromhere(Links to an external site.)orhere(Links to an external site.).

    • Those are the daily average temperature data at each city from 1995~present.

      • There are four columns: month, day, year, andtemperature in Fahrenheit(F).

      • The temperature data is -99 if no data was available on that day.





  • Develop a C++ class calledAverageDailyTemperaturethat stores an average daily temperature and its date.

    • Your class may havefour member variables. (must be private)


      • type intto represent the month.


      • type intto represent theday.


      • type intto represent theyear.


      • type doubleto represent the temperature (in Fahrenheit).



    • The complete class will include all the following member/friend functions:

      • a constructor to set amonth,day, yearand temperatureas


        • AverageDailyTemperature data(month, day, year, temperature);



      • a default constructor (takes no input) that sets temperature=-99, and default number (maybe 0) for other member variable.

      • Mutators for each member variable.

      • Accessors for each member variable.

      • operator
        AverageDailyTemperatureobject)

      • operator >> to perform (istream object) >> (AverageDailyTemperatureobject)

      • Add “const” modifier formember function that does not modify member variables.

      • Use call-by-reference forinput arguments of class objects.

      • Add “const” modifier forinput arguments that are not modified in function body.



    • Divide your class code into two parts:


      • AverageDailyTemperatureclass header fileAverageDailyTemperature
        .h


      • AverageDailyTemperatureclass implementation fileAverageDailyTemperature
        .
        cpp



    • Determinenamespace nameusing your name.

      • Define yourAverageDailyTemperatureclass under the namespace.





  • Develop a C++ code to process following tasks.

    • Reads a temperature data file.

      • Program asks user to input the file name, ex: LANEWORL.txt.

      • Use yourAverageDailyTemperatureclass to store daily temperature data.

      • Exclude data of temperature=-99.

      • Usestd::vectorclass to store all data read from the file.



    • Sort the array data with the temperature in descending order.

      • Data of highesttemperaturecomes first and the lowest goes to end.

      • You may use “sort” function from “algorithm” library.









    • Export the sorted datainto a stream object.

      • The program asks users to choose two options: exporting results to either 'screen' or 'file'.







  • You may add any ordinary/member/friend functions if you need.

  • State your name in comment line for each file.

Answered Same DayApr 25, 2021

Answer To: Download a temperature data fromhere(Links to an external site.)orhere(Links to an external site.)....

Aditya answered on Apr 27 2021
153 Votes
using namespace std;
#include
#include
#include
#include >
#include
#include
#include
#include "AverageDailyTemperature.h"
int main()
{
fstream f;
string filename;
cout << "Enter The File Name : ";
cin >> filename;
int line=0;
AverageDailyTemperature arr[10000];
f.open(filename, ios::in);
if (f.is_open()) {
string tp;
while (getline(f, tp))
{
std::string s = tp;
std::vector result;
std::istringstream iss(s);
for...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here