Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Need help making a Java roulette simulator.

1. ## Need help making a Java roulette simulator.

Hi everyone, first post here.

I'm having a little trouble with my assignment where im required to write a code that simulates a roulette wheel spinning 10,000 times. The assignment is as follows:

Write a program that will simulate the spin of a roulette wheel and the landing of a ball in a slot.
When the wheel is spun a ball is released and eventually comes to land in one of many possible slots.
Our roulette wheel will have 38 slots.
Two of these are green and numbered 0 and 00.
The remaining 36 slots are numbered 1 through 36.
Of these 36:
In the number ranges from 1 to 10 and 19 to 28, odd numbers are red and even are black.
In the ranges from 11 to 18 and 29 to 36, odd numbers are black and even are red.
You could visit various web pages to see the actual layout of a roulette wheel (e.g. wikipedia) to
become more familiar with the game.
Your program must simulate 10,000 spins of the roulette wheel (begin with a seed value of
987654321). For the first 20 spins you must display where the ball has landed:
 The number of the slot (this is one of: 0, 00, 1, 2, …36)
 The colour of the slot (this is one of: green, red, black)
After simulating 10,000 spins your program must display the following 7 statistics regarding the slot
where the ball has landed
 the number of times the ball landed on a Green slot
 the number of times the ball landed on a Red slot
 the number of times the ball landed on a Black slot
 the number of times the ball landed on an odd numbered slot
 the number of times the ball landed on an even numbered slot

thanks for any help.

2. ## Re: Need help making a Java roulette simulator.

Which part of this are you stuck on? What have you tried so far?