/******************************* MAIN HEADER **********************************
 Title:            CS302 Physics
 Files:            Physics.java
           
 Author:           Nathan C. Burnett ncb@cs.wisc.edu
 Collaborators:    none

 Due Date:         2/7/01
 Completion Date:  2/9/01

 Course:           CS 302, Spring 2001, All Sections
 TA:               

 Compiler:         Sun Microsytems SDK 1.2.1
 Platform:         Solaris/x86 2.6
**************************** 80 columns wide *********************************/
import javabook2.*;
import java.lang.Math;


public class Physics {
    
    // The gravitational constant of the Earth
    public static final double g = 9.8;

    public static void main(String[] args) {
	MainWindow mainWindow = new MainWindow("Physics Exercise");
	InputBox in = new InputBox(mainWindow);
	OutputBox out = new OutputBox(mainWindow);

	double v; // the initial velocity
	double t; // time
	double d; // distance
	
	v = in.getDouble("Enter the initial velocity in m/s");
	t = in.getDouble("Enter the time in seconds");

	d = v*t + 0.5 * g * Math.pow(t,2);

	out.printLine("The distance is " + d + " meters");
	out.show();
    }
}
