//Program Name: CubeTester.java
//Programmer: Miexie D. Tulid
//Description: A class program that already tests the class Cube.java
//Date: February 04, 2009
import javax.swing.JOptionPane;
public class CubeTester{
public static void main(String args[]){
Cube Cube1=new Cube(2,2,2);
Cube Cube2=new Cube();
JOptionPane.showMessageDialog(null,"The volume and area of constructor having a parameter is: "+Cube1.displayCube(),"Volume and Area of a Cube",JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,"Now lets go to the constructor without a parameter!");
String w=JOptionPane.showInputDialog("Enter your width: ");
String h=JOptionPane.showInputDialog("Enter your height: ");
String l=JOptionPane.showInputDialog("Enter your lenght: ");
double a=Integer.parseInt(w);
double b=Integer.parseInt(h);
double c=Integer.parseInt(l);
Cube2.setDimension(a,b,c);
JOptionPane.showMessageDialog(null,"The volume and area of constructor having no a parameter is: "+Cube2.displayCube(),"Volume and Area of a Cube",JOptionPane.PLAIN_MESSAGE);
}
}
Monday, February 9, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment