Here is the signature of a method findSeason(int month)which has an input parame
ID: 3611212 • Letter: H
Question
Here is the signature of a method findSeason(int month)which has an input parameter named month of type int: public static voidfindSeason(int month) { } Complete the body of method findSeason(int month), i.e.complete the part in the curly braces, so that one of the followingString in ITALIC is printed as output: It is autumn (if the value of theinput parameter is 9,10 or 11) It is winter (if the valueof the input parameter is 12, 1 or 2) It is spring ( if thevalue of the input parameter is 3,4 or 5) It is summer ( if the value of the inputparameter is 6,7 or 8) Invalid month (otherwise) Please give comments with your code(that is the simplestone) Lifesaver points are given, as usual. Here is the signature of a method findSeason(int month)which has an input parameter named month of type int: public static voidfindSeason(int month) { } Complete the body of method findSeason(int month), i.e.complete the part in the curly braces, so that one of the followingString in ITALIC is printed as output: It is autumn (if the value of theinput parameter is 9,10 or 11) It is winter (if the valueof the input parameter is 12, 1 or 2) It is spring ( if thevalue of the input parameter is 3,4 or 5) It is summer ( if the value of the inputparameter is 6,7 or 8) Invalid month (otherwise) Please give comments with your code(that is the simplestone) Lifesaver points are given, as usual.Explanation / Answer
/* do not know how to print the output in ITALICS to the system Will get to you as soon as i know how to do that For now i am giving the function definition which prints the outputin PLAIN letters instead of ITALICS */ public static void findSeason(int month) { if( (month == 9) || (month == 10) ||(month == 11 )) //this compares whether month = 9, 10 or 11 System.out.println("It isautumn"); else if ( (month == 12) || (month == 1) ||(month == 2 )) //this compares whether month = 12, 1 or 2 System.out.println("It iswinter"); else if ( (month == 3) || (month == 4) ||(month == 5 )) //this compares whether month = 3, 4 or 5 System.out.println("It isspring"); else if ( (month == 6) || (month == 7) ||(month == 8)) //this compares whether month = 6, 7 or 8 System.out.println("It issummer"); else System.out.println("Invalidmonth"); }