Question: USING PYTHON Q4. a) Define a class named TemperatureConverter which has 6 methods by using the staticmethod: celsius_to_fahrenheit, fahrenheit_to_celsius, celsius_to_kelvin, kelvin_to_celsius, fahrenheit_to_kelvin, kelvin_to_fahrenheit Hint: C=5(F32)/9,K=C+273.15,F=9K/5459.67
USING PYTHON


Q4. a) Define a class named TemperatureConverter which has 6 methods by using the staticmethod: celsius_to_fahrenheit, fahrenheit_to_celsius, celsius_to_kelvin, kelvin_to_celsius, fahrenheit_to_kelvin, kelvin_to_fahrenheit Hint: C=5(F32)/9,K=C+273.15,F=9K/5459.67 Hint2: Test your code with the following lines and the result should be 95.0: f= TemperatureConverter.celsius_to_fahrenheit(35) print(f) Q4. b) Add a new method, called format, to TemperatureConverter class. This method takes two arguments and write the unit of the temperature to the result. Hint:Test your code with the following lines and the result should be 95.0F : print(TemperatureConverter.format(f, TemperatureConverter.FAHRENHEIT))
Step by Step Solution
There are 3 Steps involved in it
To solve this we need to define a TemperatureConverter class with the specified static methods for t... View full answer
Get step-by-step solutions from verified subject matter experts
