



|
|
CS1 Course Site
|
Wait , WAIT !!What's that word ? ( Class Notes ( without definitions ) )
Wednesday October 11 , 2000
|
|
static private void computeNumberOfExternalEdges ()
{
eeCount = (2 * nrSquares) + 2;
}
static private void displayPerimeter ()
{
IO.println ( ``The perimeter is: ``+ perimeter);
}
}
- As a result of running...
readProblemParameters
the variables
figureArea and nrSquares
were bound
- As a result of running
computeAreaOfOneSquare
The variable
square area
was bound
And so on...
The ``functional'' application architecture approach
class --------
{
static public void main (----)
{
double figureArea = readFigureArea ();
int nrSquares = readNrOfSquares ();
double squareArea = computeSquareArea (figureArea, nrSquares);
double squareSide = computeSquareSide (squareArea);
int eeCount = computeEECount (nrSquares);
double perimeter = computePerimeter (squareSide, eeCount);
IO.println ( ``Perimeter = ``+ perimeter);
}
static private double readFigureArea ()
{
IO.print ( ``Figure Area? ``);
return IO.read_double ();
}
static private int readNrOfSquares ()
{
IO.print ( ``Number Of Squares? ``);
return IO.read_int ();
}
static private double computerSqareArea (double a, double n)
{
return a /n;
}
static private double computerSquareSide (double osa)
{
return Math.sqrt (osa);
}
static private int computeEECount (double nrs)
{
return (2 * nrs) + 2;
}
static private double computePerimeter (double ss, double eec)
{
return ss * eec;
}
}
The ``object'' application architecture solution to the line of squares problem
class ------
{
static public void main (-----)
{
LineOfSquares los = new LineOfSquares ();
double p = los.perimeter ();
IO.println ( ``The perimeter is: ``+ p);
}
}
|
|