Coders Packet

Blackjack using Java

By Sagar Naskar

  • blackjack.class
  • This is a regular blackjack game written using Java programming language. This a single player game where the user plays against the bot.

    This is a regular Blackjack game using 8 decks of cards, using Java programming language.

    Input- int bet takes the betting amount as input. int choice takes the user's play choice(hit/double/stay) as input. int n is reused as an input in the later part to determine whether the user wants to keep on playing or exit the game.

    Output- The program displays everything which the game needs to display like the cards drawn by the player as well as the cards drawn by the bot. Win and lose situations are well displayed.

    The deck of cards is stored in an array. There is use of java.util.* and java.util.random packages in the program. Scanner class and random class are used to take input and generate random number in the program. Cards are pulled at random from the deck and removed simultaneously as the game. The game stops when the user has an empty purse or goes into debt; as well as the user can exit at the end of any round.

    Program output 1

    program output 2

    program output 3

    program output 4

    program output 5

    program output 6

    Download Complete Code


    No comments yet