The definition for a class called TemperatureList is given below.
Values of this type are arrays of Fahrenheit temperatures. Add a member function called get_size, which takes no arguments and returns the number of temperatures on the array.
#include <iostream
#include <cstdlib using namespace std; const int maxArraySize = 50; class TemperatureList
{ public:
TemperatureList( );
~TemperatureList( );
void add_temperature(double temperature);//Precond:list not full.
bool full( )//Returns true if the list is full; false otherwise.
void printList();
int get_size();//Returns the number of temperatures in list private: double listTemp[maxArraySize];//array of temps in Fahrenheit int currentSize; //number of array positions filled
};
//This is the implementation for the class TemperatureList.