class LineOfSquaresGPAA
static public void main (~ ~ ~ ~ ~ ~)
{
readProblemParameters ();
computeAreaOfOneSquare;
computeLengthOfSide ();
computeNumberOfExternalEdges ();
compute perimeter;
displayPerimeter ();
}
/ /The data dictionary.
static private double figureArea;
static private int nrSquares;
static private double squareArea;
static private double sideLength;
static private int eeCount;
static private double perimeter;
static private void readProblemParameters ()
{
IO.print (``Area of figure? '');
figureArea = IO.read_double ();
IO.print (``Number of squares? '');
nrSquares = IO.read_int ();
}
static private void computeAreaOfOneSquare ()
{
squareArea = figureArea /nrSquares;
}
static private void computeLengthOfOneSide ()
{
sideLength = Math.sqrt (squareArea);
}
static private void computeNumberOfExternalEdges ()
{
eeCount = (nrSquares * 2) + 2;
}
static private void computePerimeter ()
{
perimeter = eeCount * sideLength;
}
static private void displayPerimeter ()
{
IO.println (``Perimeter is ``+ perimeter);
}