100%(2)2 out of 2 people found this document helpful
This preview shows page 1 - 3 out of 3 pages.
System.out.println("Your Hand: " + player.toString());System.out.println("Your value is: " + player.cardsValue());//Dealer's Hand and valueSystem.out.println("\n Dealer Hand: " + dealer.getCard(0).toString() + " and a [Hidden] card");
if (player.cardsValue() == 21) {System.out.println("21!!! You Win");money = money + bet;roundEnd = true;break;}//Ask play to hit or staySystem.out.println("Would you like to (1)Hit or (2)Stand");int response = input_2.nextInt();//They hitif (response == 1) {player.deal(playingDeck);System.out.println("You draw a:" + player.getCard(player.deckSize() - 1).toString());//Bust if they go over 21if (player.cardsValue() > 21) {System.out.println("BUSTED! Your valued is: " + player.cardsValue());money -= bet;roundEnd = true;break;}}//Standif (response == 2) {break;}}//Reveal Dealer CardsSystem.out.println("Dealer Cards:" + dealer.toString());//See if dealer has more points than playerif ((dealer.cardsValue() > player.cardsValue()) && roundEnd == false) {System.out.println("Dealer beats you " + dealer.cardsValue()+ " to " + player.cardsValue());money -= bet;roundEnd = true;}//Dealer hits at 16 stands at 17while ((dealer.cardsValue() < 17) && roundEnd == false) {dealer.deal(playingDeck);System.out.println("Dealer draws: " + dealer.getCard(dealer.deckSize() - 1).toString());}//Display value of dealerSystem.out.println("Dealer value is : " + dealer.cardsValue());//Determine if dealer bustedif ((dealer.cardsValue() > 21) && roundEnd == false) {System.out.println("Dealer Busts. You win!");money += bet;roundEnd = true;}//Determine if pushif ((dealer.cardsValue() == player.cardsValue()) && roundEnd == false) {System.out.println("Push.");roundEnd = true;}
//Determine if player winsif ((player.cardsValue() > dealer.cardsValue()) && roundEnd == false) {System.out.println("You win the hand.");money += bet;roundEnd = true;} else if (roundEnd == false) //dealer wins{System.out.println("Dealer wins.");money -= bet;}//End of hand - put cards back in deckplayer.moveAllToDeck(playingDeck);dealer.moveAllToDeck(playingDeck);System.out.println("End of Hand.");}//Game is overSystem.out.println("Game over! You lost all your money. GOOD BYE! ");}}
You've reached the end of your free preview.
Want to read all 3 pages?
Fall '16
JOSEPH DEMASCO
Store of value, System.out.println, player, Mini Project 2