title: Trouble writing blackjack and solitaire program in java
body: <p>I have been working on this project for a few days and I can't figure out why it's not working. Hopefully a fresh set of eyes will help. When I run this, several things don't happen.</p>
  
  <p>The only thing that really works is the part that manages the bet from the user. Some problems include:</p>
  
  <ul>
  <li><p>It does not bring a card value (supposed to come from a class that randomly generates a number from 1-13).</p></li>
  <li><p>Does not wait for the user to enter 0 to draw more cards or not</p></li>
  <li>When it says what the third card is it says <code>Card@42a57993</code></li>
  <li>Gives no total card value.</li>
  <li>There's also an error that happens when I try to fix a problem. In the addition for cardTotal, the error says "the operator + is undefined for the argument types."</li>
  </ul>
  
  <p>It's possible that It is missing or has extra brackets but I can't find where they should/shouldn't be. Here is my code:</p>
  
  <pre><code>import java.util.Scanner; 
  
  public class Game {
     private double pot;
     private double bet; 
     private int answer; 
     private int cardTotal; 
  
     Card card1 = new Card();
     Card card2 = new Card();
     Card card3 = new Card(); 
  
     // constructor
     public Game(){
        pot = 100;
        bet = 0; 
     }
  
     Scanner keyboard = new Scanner(System.in);
  
     // GetBetFrom user, prompts user to enter a valid bet, reenter until a valid amount
     public double getBetFromUser(){
        System.out.println("Your current pot is: "+pot);
  
        System.out.println("Enter your bet amount");
        bet = keyboard.nextDouble();  
  
        //Rules for the bet
        while(bet&gt;pot || bet&lt;0){
           if(pot==0){
              break; 
           }
           if(bet&gt;pot){
              System.out.println("Sorry, you don't have enough money for that, try again");
              bet = keyboard.nextDouble(); 
           }
           if(bet&lt;0){
              System.out.println("That is not a valid bet, please try again");
              bet = keyboard.nextDouble(); 
           }
       }
       return bet;
    }
  
    // Game mechanics 
    public void gamePlay(){
       System.out.println("Your first card is: "+card1);
       System.out.println("Your second card is: "+card2);
       cardTotal= card1 + card2; 
       System.out.println("Your total is: "+cardTotal);
       System.out.println("Enter 0 to draw more, any other number to quit: ");
  
       if(answer == 0); {
          System.out.println("Your next card is: "+card3);
          System.out.println("Your total is: "); 
       }
   }
  
   public void results(){
      if(cardTotal &gt; 21){
         System.out.println("You lose your bet");
         pot = pot-bet; 
      }
      if(cardTotal==21){
         System.out.println("You win three times your bet");
         pot = pot-bet+(bet*3);
      }
      if(cardTotal==20){
         System.out.println("You win double your bet amount");
         pot = pot-bet+(bet*2); 
      }
      if(cardTotal&lt;=19){
         System.out.println("You win your bet amount");
      }
   }
  }
  </code></pre>
  
  <p>This is the code for my Card class</p>
  
  <pre><code>import java.util.Random; 
  
  public class Card {
  private int cardValue; 
  Random random = new Random();
  
  public Card(){
      cardValue = 1;
  }
  
  public int getCard(){
      cardValue = (cardValue + random.nextInt(12));
      if(cardValue&gt;10)
          return 10;
      else
          return cardValue;   
  }
  
  public int display(){
      switch (cardValue){
      case 1: System.out.println("Ace");
      break;
      case 2: System.out.println("Two");
      break; 
      case 3: System.out.println("Three"); 
      break; 
      case 4: System.out.println("Four");
      break;
      case 5: System.out.println("Five");
      break;
      case 6: System.out.println("Six");
      break;
      case 7: System.out.println("Seven");
      break; 
      case 8: System.out.println("Eight");
      break;
      case 9: System.out.println("Nine");
      break; 
      case 10: System.out.println("Ten");
      break; 
      case 11: System.out.println("Jack");
      break;
      case 12: System.out.println("Queen");
      break;
      case 13: System.out.println("King");
      break; 
  
      }   
      return cardValue; 
  }       
  </code></pre>
  
  <p>}</p>