Cannot get this thing to compile at all. Supposed to make a game where you start off with $10 and bet to get doubles on dice. If you win you double you're money and if you lose, well you lose you're money, lol.
<import java.util.Random; public class Die { private int faceValue; private final int MAX = 6; private Random dieGen; public Die() { faceValue = 1; dieGen = new Random(); } //Math.random creates random integers from 1 - 6 public void roll() { faceValue = dieGen.nextInt(MAX) + 1; } //Sets the face value public void setFaceValue(int value) { faceValue = value; } //Gets the face value using the setFaceValue method public int getFaceValue() { return faceValue; } public static void main (String[] args ) { Die d1, d2; // Creates two Die objects d1 = new Die(); d2 = new Die(); d1.roll(); d2.roll(); // Compare to see if faces equal public boolean isSame() { if (d1.equals(d2)) { return true; } } //Converts values into a String public String toString() { String result = d1 + " and " + d2; return result; } } >
<import java.util.Random; import java.util.Scanner; public class DoublesGame { public static void main(String args[]) { Scanner input = new Scanner(System.in); //Instance Variables int money = 10; int offer; // Create new dice d1 = new Die(); d2 = new Die(); //Amount of money and betting while(money>0 || money>1000) { System.out.println("You have $" + money); System.out.println("How much would you like to bet?"); offer = input.nextInt(); money = money - offer; // Display the result System.out.println("You rolled a " + d1 " and " + d2); } if(d1 == d2) { gained = offer * 2; system.out.println("You win $" + gained); } // After you run out of money if(money<0) { System.out.println("Better luck next time"); } } }>