/*******************************************************************************
 *  Program Title:  Babcock
 *  Files:          Babcock.java Scooper.java Tub.java
 *
 *  Author:  Brian Lee Bowers     blbowers@cs.wisc.edu
 *  Collaborators:  NONE
 *
 *  Due Date:  NONE
 *  Date Completed:  14 February 2001
 *
 *  Compiler:  Sun JDK javac (JDK 1.2.2)
 *  Platform:  SunOS 5.6 (Intel x86)
 ******************************************************************************/

/*  imports  */
import javabook2.*;

/**
 *  The top level, controller class, to determine cones per tub.
 */
public class Babcock {

	/**
	 *  Program entry point.
	 *  Get size of tub and size of scoop as user input.
	 *  Calculate the number of scoops available per tub,
	 *  then convert scoops into cones (assume 2 scoops per cone).
	 *
	 *  @param args array of command line arguments
	 */
	public static void main(String[] args) {
		final int SCOOPS_PER_CONE = 2; // number of scoops per cone
		double cones              = 0; // number of cones per tub
									   // [0.0, infinity)

		//  Get user input for size of tub and scooper
		MainWindow mainWindow = new MainWindow("Scooping for Success");
		mainWindow.setVisible(true);
		InputBox inputBox = new InputBox(mainWindow);
		double quarts = inputBox.getDouble("Enter number of quarts in the tub");
		double radius =
			inputBox.getDouble("Enter the radius (in inches) of your scooper");

		//  Construct the tub and scooper
		Tub tub = new Tub(quarts);  // the tub of icecream
		Scooper scooper = new Scooper(radius);  //  the scooper

		//  Calculate how many scoops and cones can be taken from a tub
		cones = tub.getVolume() / scooper.getVolume() / SCOOPS_PER_CONE;

		//  display the results
		OutputBox outputBox = new OutputBox(mainWindow);
		outputBox.printLine("You can get " + cones + " cones from your tub.");
		outputBox.setVisible(true);
	}
}
		
