( --> )
Pyramid Surface Area Program
--> PyramidApp
--> blue.shapes.*;
-->
// Observe the given information
double baseSide = 24.5;
double height = 92.43;
// Establish the base of the pyramid
Square base = new Square(baseSide);
// Establish a rectangle half the diagonal of the base
// by the height
double keyWidth = base.diagonal() / 2.0;
double keyHeight = height;
Rectangle key = new Rectangle(keyWidth, keyHeight);
// Establish the side of the pyramid
Triangle side = new Triangle(key.diagonal(), baseSide);
// Compute the result
double sa = base.area() + ( 4 * side.area() );
// Display the result
IO.print("The surface area is ");
IO.println(sa);
-->
indigo> java PyramidApp
The surface area is 2899.33