Question
Write a temperature converter in javascript. Inside of the file Temperature.ts class create a class Temperature The Temperature class: Should have 3 fields defined, celcius,
Write a temperature converter in javascript.
Inside of the file Temperature.ts class create a class Temperature
The Temperature class:
Should have 3 fields defined, celcius, fahrenheit, and kelvin
Should have a constructor that takes 2 arguments, unit and temp
Based on the unit it it should use the conversion formulas above to set all the fields to the correct temperature. All of the conversion work should happen in the constructor. Hint:
After your temperature class create an instance of the temperature class and console.log the fahrenheit, celsius, and kelvin temperatures. Example:
const temp = new Temperature("fahrenheit", -40);
console.log(temp.celcius);
console.log(temp.kelvin);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started