Circle - Circle.java Author Lewis/Loftus Solution to...

This preview shows pages 1–2. Sign up to view the full content.

//******************************************************************** // Circle.java Author: Lewis/Loftus // // Solution to Programming Project 6.22 //******************************************************************** / import java.awt.Graphics; import java.awt.Color; i public class Circle { private int radius; private int x, y; private Color color; //----------------------------------------------------------------- // Creates a circle object //----------------------------------------------------------------- public Circle(int centerX, int centerY, int circleRadius) { radius = circleRadius; x = centerX; y = centerY; color = Color.black; } //----------------------------------------------------------------- // Returns true if circle overlaps Circle other //----------------------------------------------------------------- public boolean overlap(Circle other) { double distance = Math.sqrt((x - other.getX()) * (x - other.getX()) + (y - other.getY()) * (y - other.getY())); return (distance < (radius + other.getRadius()));

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

Circle - Circle.java Author Lewis/Loftus Solution to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online