-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeather.java
More file actions
33 lines (23 loc) · 1.25 KB
/
Weather.java
File metadata and controls
33 lines (23 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package project3;
public class Weather {
boolean sunny;
double temperature;
double windSpeed;
double humidity;
public Weather() {}
public Weather(boolean sunny, double temperature, double windSpeed, double humidity) {
this.setSunny(sunny);
this.setTemperature(temperature);
this.setWindSpeed(windSpeed);
this.setHumidity(humidity);
} // Weather()
public final void setSunny(boolean sunny) {this.sunny = sunny;}
public boolean isSunny() {return this.sunny;}
public final void setTemperature(double temperature) {this.temperature = temperature;}
public double getTemperature() {return this.temperature;}
public final void setWindSpeed(double windSpeed) {this.windSpeed = windSpeed;}
public double getWindSpeed() {return this.windSpeed;}
public final void setHumidity(double humidity) {this.humidity = humidity;}
public double getHumidity() {return this.humidity;}
public boolean isGoodWeather() {return this.isSunny() && (this.getTemperature() >= 60.0 && this.getTemperature() <= 70.0) && this.getWindSpeed() <= 10.0 && (this.getHumidity() >= 0.4 && this.getHumidity() <= 0.5);}
} // class Weather