Question
I am trying to develop one java class for this UML diagram Thermostat Housing temperature: int cold: int heat: int van: int on: Boolean _____________________________________________________
I am trying to develop one java class for this UML diagram
Thermostat Housing
temperature: int
cold: int
heat: int
van: int
on: Boolean
_____________________________________________________
+Thermostat()
+turnOn()
+turnoff()
+setCold(newCold: int): void
+setHeat(newHeat:int): void
+setVan(newVan:int): void
+coldUp(): void
+coldDown(): void
+heatUp(): void
+heatDown(): void
+vanOn(): void
+vanAuto(): void
this is what i did
public class ThermostatHousing {
public static void main(String[] args) {
// Declare int
int temperature ; // Temperature
int cold = 70; // default cold set at 70 summer time
int heat= 72; // default heat set at 72 winter time
int hour = 24;
boolean on = false; // Temperature off
int x = (int)(Math.random() * 24); // code to create time
}
public int temerature;
public void thermostat(){ // Thermostat constructor object of the class
}
public void turnOn() { // turn on Thermostat
boolean on = true;
}
public void turnOff(){ //turn off Thermostat
boolean on = false;
}
public void cold(int cold) { // set cold temperature
boolean on = false;
int newCold = 0;
if ( on && cold >=70 && cold <= 24)
// create object of the cold class
cold = newCold;
}
public void heat(int heat) { // set cold temperature
boolean on = false;
int newHeat = 0;
if ( on && heat >=72 && heat <= 24)
// create object of the heat class
heat = newHeat;
}
}
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