You are required to develop a simple Blackjack game using Java or JavaFX on Netbeans. Use NetBeans and Scene Builder to create the user interface. This project will require a simplified version of Blackjack. You must follow the simplified rules even if you know the "real" rules. The game could be expanded to include more players and a simple betting system.
Object of the Game: Counting any ace as 1 or 11, as a player wishes, any face card (King, queen or Jack) as 10, and any other card at its numerical(Pip) value, the user attempts to beat the dealer by getting a count as close to 21 as possible, without going over 21. We will use only a single deck of cards. The dealer can receive a maximum of 5 cards. The player can receive a maximum of 5 cards. The player always goes first.
Below are the details requirements:
Create a using Java or JavaFX on Netbeans. Use NetBeans and Scene Builder to create the user interface. Name this project Blackjack (or, Twenty-One).
Make use of the following (Optional):-
A label to track the dealer's score and a label to track the player's score. You must have a heading to indicate which is which and a number for the actual score. The score should initially be 0 for both. Update the score with the proper card value each time a new card is dealt to either the player or the dealer.
A way to display up to 10 card images - 5 for the player and 5 for the dealer.
A button that when clicked deals another card to the player.
A button that when clicked indicates the player is done (doesn't want any additional cards) and the dealer should start.
A button that when clicked will reset the game after the current game is finished.
A way to display who wins each game.
You must use this "deck" of cards to represent the cards in the game. Unzip the file and add the folder (named images) to your NetBeans project. The sample projects show you how to do this.
Each game should start with two cards being dealt to the player "face up" so everyone can see what they are. Two cards are also dealt to the dealer. One of these cards is face up and the other is face down. Make sure it is clear in the user interface which cards belong to the dealer and which cards belong to the player. Cards must always be dealt in a random order. (Use the Random class.) The score for the player must be the sum of the two cards that are displayed. The score for dealer will be the score of only the card shown face up. Show me (0:47 min, .mp4).
If the player decides to take another card, "deal" a random card and display it in the user interface area assigned to the player. Increase the player's score by the points assigned to the card.
If the player's score exceeds 21, the player is "busted" and the player loses. The player's score should indicate he/she is busted. The game is over. The dealer doesn't play in this case and doesn't receive any additional cards. Show me (0:33 min, .mp4).
It becomes the dealers turn if the player is under 22 and decides to "stay" by clicking the appropriate button. The dealer (i.e. the computer) then is dealt cards until its score is between 17 and 21 inclusive. The dealer's score must be updated after each card. The dealer wins if the dealer's score is less than 22 and is larger than the player's score. Show me (0:54 min, .mp4).
The game is over under any of the following conditions. The player must click the appropriate button to start a new game. A new game returns everything to its starting point. Show me (0:54 min, .mp4).
The player is busted (i.e. has a score greater than 21). Update the user interface to indicate the dealer has won.
The dealer is busted (i.e. has a score greater than 21). Update the user interface to indicate the player has won.
The dealer has stopped receiving cards because it has a score between 17 and 21 inclusive. Compare the dealer and player scores. Update the user interface to indicate the winner based on the highest score. Dealer wins all ties.
To keep the game simple, you do not need to "shuffle". The deck contains 52 cards. Just display an alert and reset the game automatically after you have dealt all 52 cards.
A brief explanation of how the coding works in case
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.