My solution runs and prints the three weather types. It fails this condition though:
The Today class must implement the Weather interface.
I created a Today interface with the getWeatherType() method, and my Today class implements the Today interface. What could the problem be?
I didn't see the interfaces already implemented in the separate files!
package com.codegym.task.task13.task1317;
/*
Nice weather
*/
public class Solution {
interface Weather {
String getWeatherType();
}
public static void main(String[] args) {
System.out.println(new Today(WeatherType.CLOUDY));
System.out.println(new Today(WeatherType.FOGGY));
System.out.println(new Today(WeatherType.FREEZING));
}
static class Today implements Weather {
private String type;
final String CLOUDY = "cloudy";
final String FOGGY = "foggy";
final String FREEZING = "freezing";
public String getWeatherType() {
return this.type;
}
Today(String type) {
this.type = type;
}
@Override
public String toString() {
return String.format("Today it will be %s", this.getWeatherType());
}
}
}