Circle - canvas = theCanvas; } public int area() { return...

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 Circle implements IShape { public double PI = 3.14159; // Data members int centerX, centerY; int radius; Graphics canvas; public Circle(int theX, int theY, int theRadius, Graphics theCanvas ) { super(); centerX = theX; centerY = theY; radius = theRadius;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: canvas = theCanvas; } public int area() { return (int)(PI * radius * radius); } public void draw() { canvas.drawOval(centerX, centerY, radius, radius); } public void erase() { canvas.clearRect(centerX-radius, centerY-radius, 2*radius+1, 2*radius+1); } }...
View Full Document

This note was uploaded on 06/10/2011 for the course COMP 110 taught by Professor Stotts during the Spring '08 term at UNC.

Ask a homework question - tutors are online