Create a second array where you keep count of how many


Assignment

For this assignment, you are going to use Java Arrays to simulate spins of a Roulette Wheel.

Requirements:

• Name your program Assignment4.javaHave the program output your first and last name

• Email me your Assignment4.java file before class is scheduled to begin on 2/17.

• You will be simulating 99 spins of a "single zero" Roulette Wheel and storing each spin in an array. For each spin, you need to generate a random integer from 0 to 36.

• Create a second array where you keep count of how many times each value came up during the 99 spins. In this array, the zero element is how many spins came up zero, the first element is how many spins came up 1, etc.

• Output all 99 of your spins with 10 spins per line (last line has 9 spins). For each spin output the number and the color. Leave a space or two between each spin on the line.

• Color is calculated according to the following rules: In number ranges from 1 to 10 and 19 to 28, odd numbers are red and even are black. In ranges from 11 to 18 and 29 to 36, odd numbers are black and even are red. 0 is green. (see https://en.wikipedia.org/wiki/Roulette)

• Write a Java method that computes the color for a given spin. It should have one input parameter (the number that was spun) and return a character to the caller ('R','B', or 'G').

• Next, have your program output how many times each value (0,1,2...,36) came up during the 99 spins.

• Computer the mean or average spin.

• Compute the median spin. The median is the "middle" value of the list after the spins are sorted. We will discuss a median example in class together. You can use the java.util.Arrays.sort method to sort your array of spins.

• Note: I'm posting SortExample.java as an example of sorting an array. This will be helpful for the median!

• Note: I'm posting PrintExample.java as an example of printing the output values on the screen.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Create a second array where you keep count of how many
Reference No:- TGS02660413

Expected delivery within 24 Hours