Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago