Skip to content

Instantly share code, notes, and snippets.

@Mishco
Created December 9, 2022 12:40
Show Gist options
  • Select an option

  • Save Mishco/1e52e054b50f270dea8fe2baaa00bb33 to your computer and use it in GitHub Desktop.

Select an option

Save Mishco/1e52e054b50f270dea8fe2baaa00bb33 to your computer and use it in GitHub Desktop.
public class WeatherTracker {
public String currentConditions;
private Phone phone;
private Emailer emailer;
public WeatherTracker() {
phone = new Phone();
emailer = new Emailer();
}
public void setCurrentConditions(String weatherDescription) {
this.currentConditions = weatherDescription;
if (weatherDescription == "rainy") {
String alert = phone.generateWeatherAlert(weatherDescription);
System.out.print(alert);
}
if (weatherDescription == "sunny") {
String alert = emailer.generateWeatherAlert(weatherDescription);
System.out.print(alert);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment