This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes creating random mole and removing it. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "creating random mole and removing it." Watch "creating random mole and removing it." New topic
Author

creating random mole and removing it.

Mac Subedi
Greenhorn

Joined: Nov 11, 2011
Posts: 5
Here i Created Ovals and loop it until 3 . My question is how can i

1) Draw a Oval at a random location and
2) If there are more than 5 Oval present how can i remove a random Oval, So far i have done this:









I hope this question make sense whoever is trying to help me. Thank YOU













Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43984
    
  33
You would need to create an array of moles and remove a member of that array.
That is one way to do it. There are lots of others.

I think you ought to create a Mole class.
Mac Subedi
Greenhorn

Joined: Nov 11, 2011
Posts: 5
would you give me some hints in code. ThankYOU
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43984
    
  33
Mac Subedi wrote:would you give me some hints in code. ThankYOU
No. Sorry.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: creating random mole and removing it.
 
It's not a secret anymore!