/** ups0x.java (reads in package info) * * CS7 - practice with functions * * JAVADOC COMMENTS REMOVED FROM THIS VERSION */ import tio.*; class ups0 { public static void main (String[] args) { int weight, height, width, length; // get the package specifications System.out.println("Please enter the package specifications."); weight = getPosInt(" weight (lbs): "); height = getPosInt(" height (in): "); width = getPosInt(" width (in): "); length = getPosInt(" length (in): "); System.out.println(); // for testing System.out.println("Got: h=" + height + " wt=" + weight + " wd=" + width + " ln=" + length); } // end main() public static int getPosInt(String prompt) { System.out.print(prompt); int n = Console.in.readInt(); while (n <= 0) { System.out.print("Please enter a postive value: "); n = Console.in.readInt(); } return n; } // end getPosInt() } // end ups class