/* This Program denonstrates using a sentinel value to control a loop. * The Program will determine if a non-negative number is even or odd. * The Program will terminate when the user enters a negative number. */ import java.util.Scanner; class Loop5 { public static void main(String [] args){ Scanner console = new Scanner(System.in); System.out.println("Enter a non-negative integer or negative integer to quit"); int value = console.nextInt(); while(value >= 0) { if( (value % 2) == 0 ){ System.out.println(value + " is even"); } else { System.out.println(value + " is odd"); } System.out.println("Enter a non-negative integer or negative integfer to quit"); value = console.nextInt(); } System.out.println("Good bye"); } }