/* This is a program that asqks the user for a positive number. If the user enters a positive number, it terminates. Otherwise, it repeats. user enters positive number. Laura Toma csci 101 */ public class ReadPositive { public static void main (String args[]) { //set up reading from user ReadStream r = new ReadStream(); int n; //the number from the user //read an integer from user System.out.print("Please enter a positive integer: "); n = r.readInt(); r.readLine(); //repeat if necessary while (n < 0) { System.out.print("Sorry, " + n + " is not positive.."); System.out.print("Please enter a positive integer: "); n = r.readInt(); r.readLine(); } //note that at this point, n MUST be positive System.out.println("Finally!"); } //end of main } // end of class