//*********************************************** // Program Name: cubedriver.java * // Author: Pat Moss * // Date: Oct 20, 2005 Rev: 01 * // * // Demonstrate a main driver for calccube.class * //*********************************************** import java.util.Scanner; public class cubedriver { public static void main (String[] args) { String inputresponse = ""; // the user input response calccube calccube1 = new calccube(); Scanner scan = new Scanner(System.in); System.out.println ("cubedriver.java by pat moss"); System.out.println (""); System.out.println ("Calculate cube surface area and volume."); System.out.print ("To continue press 'Y', to exit press 'N':"); inputresponse = scan.nextLine().toUpperCase(); while (inputresponse.charAt(0) == 'Y') { // Use the sentinel value of 'Y' to continue the loop calccube1.docalccube(); System.out.println (""); System.out.println ("Calculate cube surface area and volume."); System.out.print ("To continue press 'Y', to exit press 'N':"); inputresponse = scan.nextLine().toUpperCase(); } System.out.println ("All Done..."); } }