import java.util.Scanner; public class OverTheTopGame { public static void main(String[] args) { Scanner console = new Scanner(System.in); Spinner wheel = new Spinner(); int totalWinnings=0; do { int spinValue = wheel.spin(); int winnings = getWinnings(spinValue); System.out.println("Your spin is " + spinValue + " for $" + winnings); totalWinnings += winnings; System.out.println("Your total is $" + totalWinnings); } while (!isOverTheTop(totalWinnings) && !isStopped(console)); if (isOverTheTop(totalWinnings)) { System.out.println("You're over the top."); } else { int host = wheel.getHostScore(); System.out.println("Host plays $" + host); if (isOverTheTop(host)) { System.out.println("Host is over the top. You won $"+totalWinnings); } else if (totalWinnings > host) { System.out.println("You won $"+totalWinnings); } else { System.out.println("You lost!"); } } } public static int getWinnings(int spinValue) { if (spinValue == 7 || spinValue == 11) return 200; else return spinValue*10; } public static boolean isOverTheTop(int dist) { return dist > 350; } public static boolean isStopped(Scanner s) { boolean isCorrect; String choice; do { System.out.print("Stop or Spin? " ); choice = s.next().toLowerCase(); isCorrect = (choice.equals("stop") || choice.equals("spin")); if (!isCorrect) System.out.println ("Error: Enter a complete word."); } while (!isCorrect); return choice.equals("stop"); } }