View Single Post
Old 10-04-2012, 03:58 AM   PM User | #1
vindeath
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
vindeath is an unknown quantity at this point
Java return statement problem.

Hello there

I have a question about the return statement... I'm not getting anything when I run my code. I should get answers like Winter, Fall, Spring, Summer but my return is not working?

Thanks for the help.

Here is my code:

Code:
	
public static void main (String[] args){
	
	season(11, 15);

}
	
public static String season(int month, int day){
	String result = "";
		
	if((month == 12 && day >=16) || (month <= 3 && day <=15))
		result += "Winter";
	else if ((month >=9 && day >=16) || (month <=12 && day <=15))
		result += "Fall";
	else if ((month >=6 && day >=16) || (month <=9 && day <=15))
		result += "Summer";			
	else if ((month >=3 && day >=16) || (month <=6 && day <=15))
		result += "Spring";
	return result;
	}
}
vindeath is offline   Reply With Quote