用JAVA创建一个代表天气对象的实体类 (a)拥有私有属性:日期,地点,风速,温度,湿度 (b)拥有属性的get,set公有方法
时间: 2024-06-01 16:10:42 浏览: 79
public class Weather {
private String date;
private String location;
private double windSpeed;
private double temperature;
private double humidity;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public double getWindSpeed() {
return windSpeed;
}
public void setWindSpeed(double windSpeed) {
this.windSpeed = windSpeed;
}
public double getTemperature() {
return temperature;
}
public void setTemperature(double temperature) {
this.temperature = temperature;
}
public double getHumidity() {
return humidity;
}
public void setHumidity(double humidity) {
this.humidity = humidity;
}
}
阅读全文