Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment you are going to use Java Arrays to simulate spins of a Roulette Wheel. Requirements: Name your program Assignment4.java Have the program

image text in transcribed
For this assignment you are going to use Java Arrays to simulate spins of a Roulette Wheel. Requirements: Name your program Assignment4.java Have the program output your first and last name Email me your Assignment4.java file before class is scheduled to begin on 2/16 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. O is green. (see example. a spin of 6 would be output as 6B, a spin of 18 would be output as "18R, and a spin of O would be output as "oG 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) For 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. This is the sum of all spins divided by how many spins 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

A study based on

Answered: 1 week ago