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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!