Question: Program 2 Objective: For this programming assignment, you will design a C + + class called Temperature that handles temperatures in different scales ( Kelvin

Program 2 Objective: For this programming assignment, you will design a C++ class called
Temperature that handles temperatures in different scales (Kelvin, Celsius, and Fahrenheit). This
class will internally store the temperature in Kelvin and provide methods to set and get the
temperature in any of the three scales.
Class Design:
Private Member Variable:
double kelvin: to store the temperature value in Kelvin.
Public Member Functions:
setTempKelvin(double): Takes a temperature in Kelvin and stores it.
setTempFahrenheit(double): Takes a temperature in Fahrenheit, converts it to
Kelvin, and stores it.
setTempCelsius(double): Takes a temperature in Celsius, converts it to Kelvin, and
stores it.
getTempKelvin(): Returns the temperature in Kelvin.
getTempFahrenheit(): Converts the stored temperature to Fahrenheit and returns it.
getTempCelsius(): Converts the stored temperature to Celsius and returns it.
Conversion Formulas:
To Kelvin:
From Celsius: Kelvin = Celsius +273.15
From Fahrenheit: Kelvin =(5.09)* Fahrenheit -32
Program 2 Objective: For this programming

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!