Created
October 23, 2015 18:35
-
-
Save edinak1/73659e5a75950408c887 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package metod; | |
| public class Spring { | |
| public static void main(String[] args) { | |
| int month=3; | |
| System.out.println("Month = "+ month); | |
| if(isSpring(month)==1) | |
| System.out.println("It is spring!"); | |
| else if(isSpring(month)==0) | |
| System.out.println("It is not spring("); | |
| else | |
| System.out.println("It is not a month!!!!!!"); | |
| month=10; | |
| System.out.println("Month = "+ month); | |
| if(isSpring(month)==1) | |
| System.out.println("It is spring!"); | |
| else if(isSpring(month)==0) | |
| System.out.println("It is not spring("); | |
| else | |
| System.out.println("It is not a month!!!!!!"); | |
| month=-100; | |
| System.out.println("Month = "+ month); | |
| if(isSpring(month)==1) | |
| System.out.println("It is spring!"); | |
| else if(isSpring(month)==0) | |
| System.out.println("It is not spring("); | |
| else | |
| System.out.println("It is not a month!!!!!!"); | |
| } | |
| static int isSpring(int month) | |
| { | |
| if(month<=0 || month>12) | |
| return -1; | |
| if(month==3 || month==4 || month==5) | |
| return 1; | |
| return 0; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment