GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes JSS Prog Project 6.18 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JSS Prog Project 6.18" Watch "JSS Prog Project 6.18" New topic
Author

JSS Prog Project 6.18

Bill James
Greenhorn

Joined: Aug 15, 2002
Posts: 1
The book doesn't mention the Circle class. Yet I've been told it is required for the solution to draw the circles. Anyone have tips so that I can draw the 20 circles randomly and change the color of the overlapping ones.
Thankyou.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Bill,
Welcome to JavaRanch!
You followed our Naming Policy, so you must be very intelligent. It's nice to have you around.
For this assignment, what do you already understand and know how to do? What have you tried or thought of trying to solve the problem? Why?
From what I've understood you to explain, you don't really need to make use of a Circle class just to draw some circles (Graphics::drawArc can be used to do that.) But I wouldn't be surprised if the point of the assignment is to create and make use of a Circle class.
What part of the assignment is slowing you down or giving you problems?
If you're not familiar with generating random numbers, take a look at java.lang.Math.random and java.util.Random .
And, if you haven't already become familiar with it, do learn to reference and understand The Java 2 Standard Edition API Specification so as to learn and understand the standard Java libraries.
Good Luck.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Here's a thought ...

class Circle can extend java.awt.Point, just add the radius to the Circle constructor.

You can use Math.random() for x and y (as Dirk suggested) to move the circles around or you can move the point (the center of the circle) by a specific amount each time to make sure that they overlap.

and java.awt.Color for the colors


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
GeeCON Prague 2014
 
subject: JSS Prog Project 6.18