/* Driver.java -- This file contains the main function for the swimming * pool example. Just like in the Circle program, all we need to do is * get input about the size of the pool...... create this pool object..... * and then determine its volume for output. */ import java.io.*; // tell compiler we'll be doing some I/O public class Driver { public static void main(String [] args) throws IOException { // Input phase. BufferedReader kbd = new BufferedReader(new InputStreamReader(System.in)); System.out.println("~~~~~Welcome to the swimming pool calculator. ~~~~~\n"); System.out.print("What is the length of your pool (in feet)? "); double inputLength = Double.parseDouble(kbd.readLine()); System.out.print("What is the width of your pool? "); double inputWidth = Double.parseDouble(kbd.readLine()); System.out.print("How deep is your pool? "); double inputDepth = Double.parseDouble(kbd.readLine()); // Calculation phase. Pool p = new Pool(inputLength, inputWidth, inputDepth); double volume = p.findVolume(); // Output phase. System.out.println("Your pool contains " + volume + " gallons of water!\n"); } }