Tell us what’s happening:
Your code so far
/* Alter code below this line */
this.Fahrenheit = Fahrenheit;
/* Alter code above this line */
const thermos = new Thermostat(76); // setting in Fahrenheit scale
let temp = thermos.temperature; // 24.44 in C
thermos.temperature = 26;
temp = thermos.temperature; // 26 in C
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36.
Challenge: Use getters and setters to Control Access to an Object
Link to the challenge:
@rajeshkumar1 You have not asked a question, so we do not know what kind of help you need.
should be able to be instantiated.
Are you asking what that means?
Running Test not completed ,what missing i don’t know.Could you please help.
Your Thermostat class (when instantiated) does not return a temperate in Celsius when referencing the temperature property of the class. Instead yours just returns the temperature in Fahrenheit (the getter) and allows you to set the temperature (the setter) in Fahrenheit. The instructions (see below) state you are to be able to set and get the temperature in Celsius.
Now create a
getter and a
setter in the class, to obtain the temperature in Celsius.