Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Help - Spinning Wheel Java help needed Please See images to understand the

ID: 3565861 • Letter: J

Question

Java Help - Spinning Wheel

Java help needed

Please See images to understand the question better

This simple game is comprised of a circular game board comprised of 16 colored squares. Your game token is the iron, which starts on the GO square.

Game play begins when the player spins a
wheel which contains the numbers 1, 2, 3, 5, 6, 7, 9, and 12.

The iron will then move ahead the number of squares based on the number that the spinners arrow points to after the spinner stops.

The order of the colored squares is:

White (GO)

Red

Blue

Green

Yellow

Red

Blue

Green

Yellow

Red

Blue

Green

Yellow

Red

Blue

Green

After landing on the new square, display the irons new location. Repeat for ten more spins, displaying the new location after each spin.

CAUTION: You will have to be clever when figuring out how to navigate the board as you move from the last square back to the first square within the array of Square objects.

Java Help - Spinning Wheel Java help needed Please See images to understand the question better This simple game is comprised of a circular game board comprised of 16 colored squares. Your game token is the iron, which starts on the GO square. Game play begins when the player spins a wheel which contains the numbers 1, 2, 3, 5, 6, 7, 9, and 12. The iron will then move ahead the number of squares based on the number that the spinner½s arrow points to after the spinner stops. The order of the colored squares is: White (GO) Red Blue Green Yellow Red Blue Green Yellow Red Blue Green Yellow Red Blue Green After landing on the new square, display the iron½s new location. Repeat for ten more spins, displaying the new location after each spin. CAUTION: You will have to be clever when figuring out how to navigate the board as you move from the last square back to the first square within the array of Square objects.

Explanation / Answer


import java.util.Random;


public class color
{
public static void main(String Args[])
{
String[] color={"White","Red","Blue","Green","Yellow","Red","Blue","Green","Yellow","Red","Blue","Green","Yellow","Red","Blue","Green"};
int[] num={1, 2, 3, 5, 6, 7, 9,12};
System.out.println("Your current position is white box.Now we are going to spin new number");
int lcolor=0;int Ccolor=0; int spinNum=0;
System.out.println("SR Spin Num Last Position Current Position ");
for(int i=0;i<=10;i++)
{
  
System.out.println(i+" "+spinNum+" "+ color[lcolor]+" "+ color[Ccolor]);
spinNum=spin(num);
  
int newNum=newColor(spinNum,color,Ccolor);
lcolor=Ccolor;
Ccolor=newNum;
  
  
}
  
  
  
  
}
public static int spin(int[] num)
{
int rand;
Random rn=new Random();
rand=rn.nextInt(8);
int spin=num[rand];
return spin;
}
public static int newColor(int spin,String[] color,int current)
{
int newNum;
if((15-current)<spin)
{
newNum=spin-(15-current)-1;
return newNum;
}
else
{
newNum=current+spin;
return newNum;
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote