Page 353 - Introduction to Programming with Java: A Problem Solving Approach
P. 353
Figure 8.8 presents a UML class diagram for our complete Square program. It’s the same as our earlier UML class diagram except that we’ve added the helper methods.
8.6 Top-Down Design 319
/**********************************************************
*
Square.java
Dean & Dean
This class manages squares.
**********************************************************/
*
*
*
import java.util.Scanner;
public class Square
{
private int width;
//********************************************************
public Square(int width)
{
this.width = width;
Apago PDF Enhancer
//********************************************************
}
public double getArea()
{
}
}
// end draw
return this.width * this.width;
//********************************************************
public void draw()
{
Scanner stdIn = new Scanner(System.in);
System.out.print("Print with (b)order or (s)olid? ");
if (stdIn.nextLine().charAt(0) == 'b')
{
}
else
{
}
drawBorderSquare();
drawSolidSquare();
Figure 8.9a
Square class: final version—part A ( an exact copy of Figure 8.7a.)