email me at borlaj@portlandschools.org

Loading
notes previous (10/<10) submit the dump links  
 

Notes

We need a whole bunch of methods

  • dealCard that will return an int 2-11 of the value of the card. No parameter. It will pick a random card and then print it out. See Chris code here for reference.
  • dealerTotal that will return what the dealer has (0,17,18,19,20,21). It will also print "Dealer busted" if it does, or what the dealer has: IE "Dealer has 17"
  • userTotal which will return what the user gets in total 0-21. No parameters.
    • Deal 2 cards, and add together: To do that you might say total=dealCard() + dealCard();
    • ask stay or hit (s or h)
    • using scanner read it int
    • while (total<=21 && they hit h)
      • dealCard & add to total -> total=total+dealCard();
      • ask do you want to hit or stay
      • read it in
    • if (total>21)
      • System out You busted
      • return 0
    • else
      • return total
  • public double findBet (double userMoney) which will find how much the user wants to bet and return that. It needs to be less than or equal to userMoney.
  • public boolean isWinner() that will play one game (calling userTotal() and dealerTotal() and printing out you win (or lose) and returning true if win, false if lose.
  • public void blackJack() that will be find a bet, play a game determine if they won, keep track of their money (remember they start w/ $1000). and repeat until findBet() =-1 and which point exit and tell them how much money they have.
  •