// 10/4/2017 /* the data type of the return value is boolean */ import java.util.Scanner; /** This class illustrates boolean method and multiple returns * */ public class booleanMethodV2 { /** main method calls isEven */ public static void main(String[] args) { System.out.print("Enter an integer: "); Scanner sc = new Scanner(System.in); int numbertoTest=sc.nextInt(); if (isEven(numbertoTest)) System.out.println("Your number is even!"); else System.out.println("your number is odd."); } /** isEven method tests whether an integer is even or odd. * @param one integer to test * @return true if parameter is even, false if parameter is odd */ public static boolean isEven(int num) { // this version, V2, uses multiple return stmts if (num%2 == 0) // num is even return true; else return false; // you can also write the single line: // return (num%2==0); } } /* Write a method that accepts (as a parameter) a double value that represents * a temperature in degrees Celcius. The method converts the degrees * Celcius to Faranheit. The method returns the degrees Faranheit. * * Write a boolean method that checks whether a number is in the range * 1 to 100. */