Square - lowerLeftX = llX; lowerLeftY = llY; length =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.Graphics; public class Square { // Data members protected int lowerLeftX, lowerLeftY; // Coordinates of lower left corner protected int height, length; protected Graphics canvas; public Square(Graphics theCanvas) { canvas = theCanvas; } public Square(int llX, int llY, int theLength, int theHeight, Graphics theCanvas ) { canvas = theCanvas;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lowerLeftX = llX; lowerLeftY = llY; length = theLength; height = theHeight; } public void draw() { canvas.drawRect(lowerLeftX, lowerLeftY, length, height); } public void erase() { canvas.clearRect(lowerLeftX, lowerLeftY, length, height); } public double area(){ double area=height*length; return height*length; } }...
View Full Document

Ask a homework question - tutors are online