** OK, So I'm trying to create a Russian Roulette Game. Half this code is supposed to play one way and the other another way (if that makes sense). Anyways I made them on two separate classes and then combined them. My problem is now every time I try to create an if statement to decide which way to play it doesn't work. I guess, I would just like some help or hints as to why this is. Like could someone point me in the right direction? (I deleted my attempts at the if statement, should I put them back?)
P.S I'm a noob to this stuff. I really don't understand. And I'm pretty sure my OddsEvenChoice if statement is incorrect but I'll worry about that later.**
package game;
import java.util.Scanner;
public class RouletteTester {
public static void main(String[] args) {
Scanner scanner = new Scanner (System.in);
int Mode;
System.out.println("Please choose how you'd like to play.");
System.out.println("To play by Odds & Evens, enter '1'");
System.out.println("To play by Numbers, enter '2'");
System.out.println("Enter game mode here: ");
Mode = scanner.nextInt();
System.out.println("You chose game mode " + Mode);
Scanner in = new Scanner (System.in);
System.out.print("Enter roulette number here: ");
int Number = in.nextInt();
RouletteWheel One = new RouletteWheel();
One.spin();
int r = One.getwinningNumber();
System.out.println(r);
if (r == Number)
System.out.println("Congratulations, The" + Number + " is a winning number!");
else
System.out.println("Sorry, " + Number + " is not a winning number.");
if (r == 0)
System.out.println("Congratulations, 0 is an automatic win!");
Scanner inn = new Scanner (System.in);
System.out.println("Odds or Evens? Type '1' for odds"
+ " or '2' for evens: ");
int Numberr = inn.nextInt();
if (Numberr == 1)
System.out.println("You choose Odds.");
else
System.out.println("You choose Evens.");
One.spin();
int winningNumber = One.getwinningNumber();
boolean n = One.OddEvenChoice();
System.out.println("The wheel landed on...");
System.out.println(winningNumber);
if ((n == true) && (winningNumber % 2 == 0))
System.out.println("You Win! E");
else if ((n == false) && (winningNumber %2 == 1))
System.out.println("You Win! O");
else
System.out.println("You Lose.");
} }
Aucun commentaire:
Enregistrer un commentaire