1 /* 2 // A program on how to solve simple geometrical problems by means of the construction and use of basic shapes 3 */ 4 5 package shapes; 6 7 public class ShapesThing { 8 public static void main(String[] args) { 9 10 //Introducing a variable called square of type SSquare, 11 // Binding to a new square of side 400 12 SSquare square = new SSquare(400); 13 System.out.println("square = " + square.toString()); 14 System.out.println("area of square = " + square.area()); 15 System.out.println("perimeter of square = " + square.perimeter()); 16 System.out.println("diagonal of square = " + square.diagonal()); 17 18 //Establishing a circle called disk of type SCircle, 19 // Binding it to the inscribing circle of the variable to which square is bound 20 SCircle disk = square.inscribingCircle(); 21 System.out.println("disk = " + disk.toString()); 22 System.out.println("area of disk = " + disk.area()); 23 System.out.println("perimeter of disk = " + disk.perimeter()); 24 25 SSquare diamond = disk.inscribingSquare(); 26 System.out.println("diamond = " + diamond.toString()); 27 System.out.println("area of diamond = " + diamond.area()); 28 29 30 31 32 33 34 } 35 } 36 37