I created a method class that will test the months and days and tell you what the season is. I'm creating a tester class but for some reason it won't recognize the getSeason()
class from the methods but it shows they are connected.
Method Code:
public class Season {
private String season;
public String getSeason(int month, int day) {
if (month == 1 || month == 2 || month == 3) {
season = "Winter";
} else if (month == 4 || month == 5 || month == 6) {
season = "Spring";
} else if (month == 7 || month == 8 || month == 9) {
season = "Summer";
} else if (month == 10 || month == 11 || month == 12) {
season = "Fall";
}
if (month % 3 == 0 && day >= 21) {
if (season.equals("Winter")) {
season = "Spring";
} else if (season.equals("Spring")) {
season = "Summer";
} else if (season.equals("Summer")) {
season = "Fall";
} else {
season = "Winter";
}
}
return season;
}
}
Tester Code:
import java.util.Scanner;
public class SeasonTester {
public static void main(String[] args) {
Season s = new getSeason();
Scanner input = new Scanner(System.in);
}
}
I get a cannot get symbol - class getSeason error when I compile