public class p10q2 {
public static void main(String[] args) {
// Declare an array named sqArray to store 10 instances of the Square class.
Square[] sqArray = new Square[10];
System.out.println("Length\tArea");
for (int i=0; i<sqArray.length;i++){
// create 10 instances of the Square
int randLength = 10 + (int) (Math.random()*11);
sqArray[i] = new Square(randLength);
System.out.println(sqArray[i].getLength()
+ "\t" + sqArray[i].calculateArea());
}//end for
} //end main
} //end class
Wednesday, December 06, 2006
Practical 10 Question 2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment