Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating random mole and removing it.

 
Mac Subedi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
would you give me some hints in code. ThankYOU
 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mac Subedi wrote:would you give me some hints in code. ThankYOU
No. Sorry.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic