I'm stuck and I hate this. Someone help me out please.
Program Assignment:

Write a graphics program that asks the user to specify the radii of two circles. The first circle has center (100,200), and the second circle has center(200,100). Draw the circles. If they intersect, then display a message "Circles intersect." Otherwise, display "Circles don't intersect." Hint: Compute the distance between the centers and compare it to the radii. Your program should draw nothing if the user enters a negative radius.

You'll need another IF statement to deal with the drawing of the circles and NEGATIVE numbers. If the numbers ARE NOT negative the cirlces are drawn.

I'm not totally sure why you need to have two classes here. Would the Circle.java deal with the code to draw the circles...and would the applet code use this to draw the circles once the user has input the desired numbers?

Hope this is of some use to you
Joyous Monkey

09-30-2002, 09:24 AM

Pankaj

Hi,
you may consider following for adding to your code:

1) Add a method that takes two points as input and returns the distance between two points :

g.drawOval(int x,int y,int width,int height);
/*
x - the x coordinate of the upper left corner of the oval to be drawn.
y - the y coordinate of the upper left corner of the oval to be drawn.
width - the width of the oval to be drawn.
height - the height of the oval to be drawn.
Thus if width=height then it will draw a circle.
*/
3) You can eliminate few lines by just adding import java.awt.* instead of importing each class individually - unless you are trying to learn the fundamentals of java packages.
bye
Pankaj