class temp { |
public: |
temp() {t = 0.0; scale = 'C';} // default constructor |
temp(double x) { t = x; scale = 'C'; } // one arg constructor |
temp(double x, char sc) { t = x; scale = sc; } // two arg constructor |
// set the temperature and scale |
void setTemp(double v, char sc) { t = v; scale = sc;} |
double getCelsius(); // get the temperature as Celsius |
char getScale() { return scale; } // fetch the scale |
double getTemp() { return t; } // fetch the temp |
void printTemp() { cout << t << " Degrees " << showScale();} |
private: |
double t; // actual temperature reading |
char scale; // Which scale? Celsius, Kelvin, Fahrenheit, Rankine |
// private methods can only be called from other methods in the class |
char * showScale(); // return the scale in English |
} ; |