Using java For this program I will need to create a game of

Using java

For this program, I will need to create a game of blackjack. The menu should consist of

1. New Deck.

2. Shuffle cards in Deck

3. Display all cards remaining in the deck

4. Play Blackjack

First page - instructions

2ND PAGE

SAMPLE GAME:

THIRD PAGE - CONTINUATION OF THE SAMPLE GAME AND FINAL RESULTS

Here is a program for all you High Rollers.\' In this assignment you will simulate a Blackjack game (also known as \"21\") Your menu should look like this: 1. New Deck. 2. Shuffle cards in Deck. 3. Display all cards remaining in the deck. 4. Play Black Jack. Option 1 will create a new deck of playing cards. This deck of cards will be an array (please use an ArrayList- not an array) of 52 cards. The order of the cards will be the same each time option one is selected. Option 2 will shuffle the cards in preparation for playing the game of Black Jack. This shuffle should mix the cards up in a random order. Also, it should shuffle however many cards are in the deck. After selecting a \"New Deck\" there will be 52 cards. After playing one hand of Black Jack, there will be fewer cards in the deck. You should be able to shuffle just the remaining cards. Option 3 will display the all cards that are stll i the deck. Option 4 will play the game. Here are the rules of BlackJack: The game is played with two players which are the computer against the player. We will refer to the computer as the \"Dealer\". The object is to get as close as possible to 21 without going over and also try to beat the dealer\'s hand. The value of each card is the numeric value of the card except for face cards which have the following values:

Solution

Kristopherr\'s structure

import random

creating the deck of cards

cards = [\'AS\', \'KS\', \'QS\', \'JS\', \'10S\', \'9S\', \'8S\', \'7S\', \'6S\', \'5S\', \'4S\', \'3S\', \'2S\',\\

         \'AD\', \'KD\', \'QD\', \'JD\', \'10D\', \'9D\', \'8D\', \'7D\', \'6D\', \'5D\', \'4D\', \'3D\', \'2D\',\\

         \'AC\', \'KC\', \'QC\', \'JC\', \'10C\', \'9C\', \'8C\', \'7C\', \'6C\', \'5C\', \'4C\', \'3C\', \'2C\',\\

         \'AH\', \'KH\', \'QH\', \'JH\', \'10H\', \'9H\', \'8H\', \'7H\', \'6H\', \'5H\', \'4H\', \'3H\', \'2H\']

player = input(\'How many players? \')

hand1 = []

hand2 = []

hand3 = []

hand4 = []

hand5 = []

hand6 = []

hand7 = []

hand8 = []

hand9 = []

hand10 = []

hand11 = []

hand12 = []

hand13 = []

hand14 = []

hand15 = []

#shuffle the cards

random.shuffle(cards)

num = input(\'How many cards to deal to each player? \')

while num > 0:

    if player == 1:

        hand1.append(cards.pop(0))

    if player == 2:  

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

    if player == 3:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

    if player == 4:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

    if player == 5:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

    if player == 6:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

    if player == 7:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

        hand7.append(cards.pop(0))

    if player == 8:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

        hand7.append(cards.pop(0))

        hand8.append(cards.pop(0))

    if player == 9:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

        hand7.append(cards.pop(0))

        hand8.append(cards.pop(0))

        hand9.append(cards.pop(0))

  if player == 10:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

        hand7.append(cards.pop(0))

        hand8.append(cards.pop(0))

        hand9.append(cards.pop(0))

        hand10.append(cards.pop(0))

    if player == 11:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

        hand7.append(cards.pop(0))

        hand8.append(cards.pop(0))

        hand9.append(cards.pop(0))

        hand10.append(cards.pop(0))

        hand11.append(cards.pop(0))

    if player == 12:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

        hand7.append(cards.pop(0))

        hand8.append(cards.pop(0))

        hand9.append(cards.pop(0))

        hand10.append(cards.pop(0))

        hand11.append(cards.pop(0))

        hand12.append(cards.pop(0))

    if player == 13:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

        hand7.append(cards.pop(0))

        hand8.append(cards.pop(0))

        hand9.append(cards.pop(0))

        hand10.append(cards.pop(0))

        hand11.append(cards.pop(0))

        hand12.append(cards.pop(0))

        hand13.append(cards.pop(0))

    if player == 14:

        hand1.append(cards.pop(0))

        hand2.append(cards.pop(0))

        hand3.append(cards.pop(0))

        hand4.append(cards.pop(0))

        hand5.append(cards.pop(0))

        hand6.append(cards.pop(0))

        hand7.append(cards.pop(0))

        hand8.append(cards.pop(0))

        hand9.append(cards.pop(0))

        hand10.append(cards.pop(0))

        hand11.append(cards.pop(0))

        hand12.append(cards.pop(0))

        hand13.append(cards.pop(0))

        hand14.append(cards.pop(0))

    num = num - 1

if player == 1:

    print hand1

if player == 2:

    print hand1

    print hand2

if player == 3:

    print hand1

    print hand2

    print hand3

if player == 4:

    print hand1

    print hand2

    print hand3

    print hand4

if player == 5:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

if player == 6:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

if player == 7:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

    print hand7

if player == 8:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

    print hand7

    print hand8

if player == 9:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

    print hand7

    print hand8

    print hand9

if player == 10:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

    print hand7

    print hand8

    print hand9

    print hand10

if player == 11:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

    print hand7

    print hand8

    print hand9

    print hand10

    print hand11

if player == 12:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

    print hand7

    print hand8

    print hand9

    print hand10

    print hand11

    print hand12

if player == 13:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

    print hand7

    print hand8

    print hand9

    print hand10

    print hand11

    print hand12

    print hand13

if player == 14:

    print hand1

    print hand2

    print hand3

    print hand4

    print hand5

    print hand6

    print hand7

    print hand8

    print hand9

    print hand10

    print hand11

    print hand12

    print hand13

    print hand14

print \'the cards remaining in the deck are: \'

print cards

Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re
Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re
Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re
Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re
Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re
Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re
Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re
Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re
Using java For this program, I will need to create a game of blackjack. The menu should consist of 1. New Deck. 2. Shuffle cards in Deck 3. Display all cards re

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site