📄 heatindexdisplay.java
字号:
package DP.Chapter2;
public class HeatIndexDisplay implements Observer, DisplayElement {
private float temperature;
private float humidity;
private Subject weatherData;
private float heatindex=temperature+humidity;
public HeatIndexDisplay(Subject weatherData) {
this.weatherData = weatherData;
weatherData.registerObserver(this);
}
public void update(float temp, float humidity, float pressure) {
this.temperature = temp;
this.humidity = humidity;
display();
}
public void display() {
System.out.print(heatindex);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -