I am in a low level class and I get stuck right after this:
This is my Tester class:import java.util.Scanner;
/**
This program calculates the season for a given month and day.
*/
public class Seasons
{
public static void main(String[] args)
{
String season;
Scanner in = new Scanner(System.in);
System.out.print("Please enter a date (month and day): " );
int month = in.nextInt();
int day = in.nextInt();
Season s = new Season(month, day);
System.out.println("Season: " + s.getDescription());
}
}
And this is my main class "season"
class Season{
private int month;
private int day;
public Season(int aMonth, int aDay)
{
int month = aMonth;
int day = aDay;
}
public String getDescription()
{
{
String r;
if (month==1){r = "Winter"; }
else if (month==2){r = "Winter"; }
else if (month==3){r = "Winter"; }
else if (month==4){r = "Spring"; }
else if (month==5){r = "Spring"; }
else if (month==6){r = "Spring"; }
else if (month==7){r = "Summer"; }
else if (month==8){r = "Summer"; }
else if (month==9){r = "Summer"; }
else if (month==10){r = "Fall"; }
else if (month==11){r = "Fall"; }
else if (month==12){r = "Fall"; }
else {r = "Not valid";}
return r;
}
}
}