Question Solved1 Answer Write this in Java Please. Assignment Instructions 1. Use only Eclipse IDE. 2. The due date for this assignment is posted in Blackboard. The Problem In this assignment we are implementing a game called Punto Banco (explained later) along with some reports such as finding the top players with most of number of wins. The application will provide players with a starting balance and will allow them to earn more by winning the games. Each time a player starts a game, the application program should keep track of the balance the player has from previous games they have played that session. The program must have the following features: When the program starts up, you must check to see if a file called Casinolnfo.txt exists in the res directory. o If it does exist, you must load the info from the file into an arrayList, each record in the file is (should be) formatted as follows: Name, balance, # of wins e.g.: Khosro, 100,21 o If the file does not exist, you must create Casinoinfo.txt and store all of the records in it before closing the program at the end. After the startup, you must present a menu that allows them to choose from the following options: Select one of these options: (P) Play game (S) Search (E) Exit Enter a choice: o The options above must be selectable with the given letters. Both upper and lower case characters should be acceptable (This requirement applies to all of the menus in this assignment). An invalid input should print an error message and re-prompt for an acceptable response (This also applies to all user inputs as well). o (P) Play Game: This option lunches the Punto Banco game. The rules will be explained later o(s) Search: This option shows a sub-menu to the user: Select one of these options: (T) Top player (Most number of wins) (N) Looking for a Name (B) Back to Main menu Enter a choice: (T) Top player: This option shows the information of the players with highest number of the wins and returns to the main menu after that pressing "Enter": Select one of these options: (T) Top player (Most number of wins) (N) Looking for a Name (B) Back to Main menu Enter a choice: t User's choice TOP PLAYERS INAME # WINS List of top players 118 Khosro Eli 118 Getting back to the main menu after pressing "Enter" Press "Enter" to continue... (N) Looking for a Name: This option prompts the user for a name, and searches the database respectively and shows the retrieved the information if the there exists a player with that name, it informs the user if there is no player that name. At the end, the app goes back to the main menu after pressing "Enter". User's choice Select one of these options (T) Top player (Most number of wins) (N) Looking for a Nane (B) Back to Main menu Enter a choice: The app asks for a name What is your name: Khosro - PLAYER INFO INAME # WINS BALANCE The player info Khosro 118 11639 $ Press "Enter" to continue... Back to the main menu after Pressing "Enter" (8) Back to main menu: This option will take the user to the main menu (E) Exit: This option in the main menu will save the latest players info first and closes the app then. Select one of these options: IPI Play gate IS) Search (E) Exit Enter a choice! Saving... Done! Please visit us again! Punto Banco Game Rules The following description is for one round of the game. At the end of the round, the user must be asked if they want to play again or return to the main menu. Upon launching the game, the app asks for the player's name. If the player's name already exists in the database, the app shows a welcome back message as following: What is your name: Khosro Welcome back KHOSRO Your balance is: 1639 $ If the user is a new player (not exists in the database) we create a new account with initial balance of 100$: what is your name:John Welcome JOHN Your initial balance is: 100 $ *** **************** Then the user will be asked which outcome they would like to bet on. The three outcomes are: Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: Then the user will be asked which outcome they would like to bet on. The three outcomes are: Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: The game then asks about the how much the player wants to bet this round: How much do you want to bet this round? Once a bet is made, the game must be played, the winner (Player or Banker) determined, and then the bet should be paid out if the user picked the correct outcome. Punto Banco Basics: Punto Banco is a casino game in which gamblers bet on the outcome of a game. What this means is that unlike in most casino games, the gambler is not technically playing the game. Instead, the Player (Punto) and Banker (Banco) play according to a fixed set of rules, and the gambler may bet on the Player (Punto), Banker (Banco), or a tie (Egalite). The value of the player and Banker hands in the game are calculated by summing the value of the cards, modulo 10. Thus, a sum of 10 results in a hand value of 0, and a sum of 18 results in a hand value of 8. In the game, cards with a rank of 2 through 9 are worth the value of their rank, face cards (Jack, Queen and King) and 10s are worth 0, and Aces are worth 1. The sequence of play in the game is as follows: 1. The Player gets a card face up. 2. The Bank gets a card face up. 3. The Player gets a second card face up. 4. The Bank gets a second card face up. a. Both hands should be printed to the screen (clearly marking each hand) 5. If the Player or Banker has a total of 8 or 9, no more cards are dealt (skip to 8). 6. If the Player has a total of 0-5, the player gets a third card face up. 7. The bank may get a third card face up, depending on whether the Player received a third card, which card, if anything, the Player drew and the Banker's total: a. If the player did not draw a card, the Banker draws if he (the Banker) has 0-5, and stands if he has 6-7. b. If the Player drew a 2 or 3, the Banker draws if he (the Banker) has 0-4, and stands if he has 5-7. If the Player drew a 4 or 5, the Banker draws if he has 0-5, and stands if he has 6-7. d. If the player drew a 6 or 7, the Banker draws if he has 0-6, and stands if he has 7. If the Player drew an 8, the Banker draws if he has 0-2, and stands if he has 3-7. f. If the Player drew an Ace, 9, 10, or face card (Jack, Queen or King), the Banker draws if he has 0-3, and stands if he has 4-7. 8. At this point, the result of the game is determined: The Player wins if his total beats the Banker, and the Banker wins if his total beats the Player. Or, if the totals are the same, the result is a tie (Egalite). c. e. A successful bet on the player and Banker wins what was bet, and a successful bet on a tie wins 5 to 1 (100 in gets 500 back). Two sample outputs of the game: Your balance is: 1639 CODEC. COCOSCOS *** Welcome back KHOSRO ********* Who do you want to bet on? (P) Player wins (B) Banker Wins (T) Tie Gate KORRA *** Do you want to play again(Y/N)?y ( Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: p How much do you want to bet this round? 175 Enter your choice: How much do you want to be this round? 180 - PUNTO BANCO PUNTO BANCO - . IBANKER TIPLAYER BANKER SER | 8 of Clubs 12 of Hearts 11 PLAYER I 2 of Diamond 1 B of Diamond Queen of Spades | Jack of Hearts Ace of Diamond Jack of Spades I 5 of Diamond Queen of Hearts Banker POINTS: 1 IPLAYER POINTS: 7 PLAYER POINTS: Banker POINTS: 8 SSSSSSSSSSSSSSSSSSSSSSSSSSS$$$$$ 5 PLAYER MON 1885 $ $ $$$$$$$$$$$$$$$$$$$$$55555555555 $PLAYER Losss$$$ $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Do you want to play againY/N)? Do you want to play again(Y/N) ?

8IUY43 The Asker · Computer Science

Write this in Java Please.

Transcribed Image Text: Assignment Instructions 1. Use only Eclipse IDE. 2. The due date for this assignment is posted in Blackboard. The Problem In this assignment we are implementing a game called Punto Banco (explained later) along with some reports such as finding the top players with most of number of wins. The application will provide players with a starting balance and will allow them to earn more by winning the games. Each time a player starts a game, the application program should keep track of the balance the player has from previous games they have played that session. The program must have the following features: When the program starts up, you must check to see if a file called Casinolnfo.txt exists in the res directory. o If it does exist, you must load the info from the file into an arrayList, each record in the file is (should be) formatted as follows: Name, balance, # of wins e.g.: Khosro, 100,21 o If the file does not exist, you must create Casinoinfo.txt and store all of the records in it before closing the program at the end. After the startup, you must present a menu that allows them to choose from the following options: Select one of these options: (P) Play game (S) Search (E) Exit Enter a choice: o The options above must be selectable with the given letters. Both upper and lower case characters should be acceptable (This requirement applies to all of the menus in this assignment). An invalid input should print an error message and re-prompt for an acceptable response (This also applies to all user inputs as well). o (P) Play Game: This option lunches the Punto Banco game. The rules will be explained later o(s) Search: This option shows a sub-menu to the user: Select one of these options: (T) Top player (Most number of wins) (N) Looking for a Name (B) Back to Main menu Enter a choice: (T) Top player: This option shows the information of the players with highest number of the wins and returns to the main menu after that pressing "Enter": Select one of these options: (T) Top player (Most number of wins) (N) Looking for a Name (B) Back to Main menu Enter a choice: t User's choice TOP PLAYERS INAME # WINS List of top players 118 Khosro Eli 118 Getting back to the main menu after pressing "Enter" Press "Enter" to continue... (N) Looking for a Name: This option prompts the user for a name, and searches the database respectively and shows the retrieved the information if the there exists a player with that name, it informs the user if there is no player that name. At the end, the app goes back to the main menu after pressing "Enter". User's choice Select one of these options (T) Top player (Most number of wins) (N) Looking for a Nane (B) Back to Main menu Enter a choice: The app asks for a name What is your name: Khosro - PLAYER INFO INAME # WINS BALANCE The player info Khosro 118 11639 $ Press "Enter" to continue... Back to the main menu after Pressing "Enter" (8) Back to main menu: This option will take the user to the main menu (E) Exit: This option in the main menu will save the latest players info first and closes the app then. Select one of these options: IPI Play gate IS) Search (E) Exit Enter a choice! Saving... Done! Please visit us again! Punto Banco Game Rules The following description is for one round of the game. At the end of the round, the user must be asked if they want to play again or return to the main menu. Upon launching the game, the app asks for the player's name. If the player's name already exists in the database, the app shows a welcome back message as following: What is your name: Khosro Welcome back KHOSRO Your balance is: 1639 $ If the user is a new player (not exists in the database) we create a new account with initial balance of 100$: what is your name:John Welcome JOHN Your initial balance is: 100 $ *** **************** Then the user will be asked which outcome they would like to bet on. The three outcomes are: Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: Then the user will be asked which outcome they would like to bet on. The three outcomes are: Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: The game then asks about the how much the player wants to bet this round: How much do you want to bet this round? Once a bet is made, the game must be played, the winner (Player or Banker) determined, and then the bet should be paid out if the user picked the correct outcome. Punto Banco Basics: Punto Banco is a casino game in which gamblers bet on the outcome of a game. What this means is that unlike in most casino games, the gambler is not technically playing the game. Instead, the Player (Punto) and Banker (Banco) play according to a fixed set of rules, and the gambler may bet on the Player (Punto), Banker (Banco), or a tie (Egalite). The value of the player and Banker hands in the game are calculated by summing the value of the cards, modulo 10. Thus, a sum of 10 results in a hand value of 0, and a sum of 18 results in a hand value of 8. In the game, cards with a rank of 2 through 9 are worth the value of their rank, face cards (Jack, Queen and King) and 10s are worth 0, and Aces are worth 1. The sequence of play in the game is as follows: 1. The Player gets a card face up. 2. The Bank gets a card face up. 3. The Player gets a second card face up. 4. The Bank gets a second card face up. a. Both hands should be printed to the screen (clearly marking each hand) 5. If the Player or Banker has a total of 8 or 9, no more cards are dealt (skip to 8). 6. If the Player has a total of 0-5, the player gets a third card face up. 7. The bank may get a third card face up, depending on whether the Player received a third card, which card, if anything, the Player drew and the Banker's total: a. If the player did not draw a card, the Banker draws if he (the Banker) has 0-5, and stands if he has 6-7. b. If the Player drew a 2 or 3, the Banker draws if he (the Banker) has 0-4, and stands if he has 5-7. If the Player drew a 4 or 5, the Banker draws if he has 0-5, and stands if he has 6-7. d. If the player drew a 6 or 7, the Banker draws if he has 0-6, and stands if he has 7. If the Player drew an 8, the Banker draws if he has 0-2, and stands if he has 3-7. f. If the Player drew an Ace, 9, 10, or face card (Jack, Queen or King), the Banker draws if he has 0-3, and stands if he has 4-7. 8. At this point, the result of the game is determined: The Player wins if his total beats the Banker, and the Banker wins if his total beats the Player. Or, if the totals are the same, the result is a tie (Egalite). c. e. A successful bet on the player and Banker wins what was bet, and a successful bet on a tie wins 5 to 1 (100 in gets 500 back). Two sample outputs of the game: Your balance is: 1639 CODEC. COCOSCOS *** Welcome back KHOSRO ********* Who do you want to bet on? (P) Player wins (B) Banker Wins (T) Tie Gate KORRA *** Do you want to play again(Y/N)?y ( Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: p How much do you want to bet this round? 175 Enter your choice: How much do you want to be this round? 180 - PUNTO BANCO PUNTO BANCO - . IBANKER TIPLAYER BANKER SER | 8 of Clubs 12 of Hearts 11 PLAYER I 2 of Diamond 1 B of Diamond Queen of Spades | Jack of Hearts Ace of Diamond Jack of Spades I 5 of Diamond Queen of Hearts Banker POINTS: 1 IPLAYER POINTS: 7 PLAYER POINTS: Banker POINTS: 8 SSSSSSSSSSSSSSSSSSSSSSSSSSS$$$$$ 5 PLAYER MON 1885 $ $ $$$$$$$$$$$$$$$$$$$$$55555555555 $PLAYER Losss$$$ $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Do you want to play againY/N)? Do you want to play again(Y/N) ?
More
Transcribed Image Text: Assignment Instructions 1. Use only Eclipse IDE. 2. The due date for this assignment is posted in Blackboard. The Problem In this assignment we are implementing a game called Punto Banco (explained later) along with some reports such as finding the top players with most of number of wins. The application will provide players with a starting balance and will allow them to earn more by winning the games. Each time a player starts a game, the application program should keep track of the balance the player has from previous games they have played that session. The program must have the following features: When the program starts up, you must check to see if a file called Casinolnfo.txt exists in the res directory. o If it does exist, you must load the info from the file into an arrayList, each record in the file is (should be) formatted as follows: Name, balance, # of wins e.g.: Khosro, 100,21 o If the file does not exist, you must create Casinoinfo.txt and store all of the records in it before closing the program at the end. After the startup, you must present a menu that allows them to choose from the following options: Select one of these options: (P) Play game (S) Search (E) Exit Enter a choice: o The options above must be selectable with the given letters. Both upper and lower case characters should be acceptable (This requirement applies to all of the menus in this assignment). An invalid input should print an error message and re-prompt for an acceptable response (This also applies to all user inputs as well). o (P) Play Game: This option lunches the Punto Banco game. The rules will be explained later o(s) Search: This option shows a sub-menu to the user: Select one of these options: (T) Top player (Most number of wins) (N) Looking for a Name (B) Back to Main menu Enter a choice: (T) Top player: This option shows the information of the players with highest number of the wins and returns to the main menu after that pressing "Enter": Select one of these options: (T) Top player (Most number of wins) (N) Looking for a Name (B) Back to Main menu Enter a choice: t User's choice TOP PLAYERS INAME # WINS List of top players 118 Khosro Eli 118 Getting back to the main menu after pressing "Enter" Press "Enter" to continue... (N) Looking for a Name: This option prompts the user for a name, and searches the database respectively and shows the retrieved the information if the there exists a player with that name, it informs the user if there is no player that name. At the end, the app goes back to the main menu after pressing "Enter". User's choice Select one of these options (T) Top player (Most number of wins) (N) Looking for a Nane (B) Back to Main menu Enter a choice: The app asks for a name What is your name: Khosro - PLAYER INFO INAME # WINS BALANCE The player info Khosro 118 11639 $ Press "Enter" to continue... Back to the main menu after Pressing "Enter" (8) Back to main menu: This option will take the user to the main menu (E) Exit: This option in the main menu will save the latest players info first and closes the app then. Select one of these options: IPI Play gate IS) Search (E) Exit Enter a choice! Saving... Done! Please visit us again! Punto Banco Game Rules The following description is for one round of the game. At the end of the round, the user must be asked if they want to play again or return to the main menu. Upon launching the game, the app asks for the player's name. If the player's name already exists in the database, the app shows a welcome back message as following: What is your name: Khosro Welcome back KHOSRO Your balance is: 1639 $ If the user is a new player (not exists in the database) we create a new account with initial balance of 100$: what is your name:John Welcome JOHN Your initial balance is: 100 $ *** **************** Then the user will be asked which outcome they would like to bet on. The three outcomes are: Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: Then the user will be asked which outcome they would like to bet on. The three outcomes are: Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: The game then asks about the how much the player wants to bet this round: How much do you want to bet this round? Once a bet is made, the game must be played, the winner (Player or Banker) determined, and then the bet should be paid out if the user picked the correct outcome. Punto Banco Basics: Punto Banco is a casino game in which gamblers bet on the outcome of a game. What this means is that unlike in most casino games, the gambler is not technically playing the game. Instead, the Player (Punto) and Banker (Banco) play according to a fixed set of rules, and the gambler may bet on the Player (Punto), Banker (Banco), or a tie (Egalite). The value of the player and Banker hands in the game are calculated by summing the value of the cards, modulo 10. Thus, a sum of 10 results in a hand value of 0, and a sum of 18 results in a hand value of 8. In the game, cards with a rank of 2 through 9 are worth the value of their rank, face cards (Jack, Queen and King) and 10s are worth 0, and Aces are worth 1. The sequence of play in the game is as follows: 1. The Player gets a card face up. 2. The Bank gets a card face up. 3. The Player gets a second card face up. 4. The Bank gets a second card face up. a. Both hands should be printed to the screen (clearly marking each hand) 5. If the Player or Banker has a total of 8 or 9, no more cards are dealt (skip to 8). 6. If the Player has a total of 0-5, the player gets a third card face up. 7. The bank may get a third card face up, depending on whether the Player received a third card, which card, if anything, the Player drew and the Banker's total: a. If the player did not draw a card, the Banker draws if he (the Banker) has 0-5, and stands if he has 6-7. b. If the Player drew a 2 or 3, the Banker draws if he (the Banker) has 0-4, and stands if he has 5-7. If the Player drew a 4 or 5, the Banker draws if he has 0-5, and stands if he has 6-7. d. If the player drew a 6 or 7, the Banker draws if he has 0-6, and stands if he has 7. If the Player drew an 8, the Banker draws if he has 0-2, and stands if he has 3-7. f. If the Player drew an Ace, 9, 10, or face card (Jack, Queen or King), the Banker draws if he has 0-3, and stands if he has 4-7. 8. At this point, the result of the game is determined: The Player wins if his total beats the Banker, and the Banker wins if his total beats the Player. Or, if the totals are the same, the result is a tie (Egalite). c. e. A successful bet on the player and Banker wins what was bet, and a successful bet on a tie wins 5 to 1 (100 in gets 500 back). Two sample outputs of the game: Your balance is: 1639 CODEC. COCOSCOS *** Welcome back KHOSRO ********* Who do you want to bet on? (P) Player wins (B) Banker Wins (T) Tie Gate KORRA *** Do you want to play again(Y/N)?y ( Who do you want to bet on? (P) Player Wins (B) Banker Wins (T) Tie Game Enter your choice: p How much do you want to bet this round? 175 Enter your choice: How much do you want to be this round? 180 - PUNTO BANCO PUNTO BANCO - . IBANKER TIPLAYER BANKER SER | 8 of Clubs 12 of Hearts 11 PLAYER I 2 of Diamond 1 B of Diamond Queen of Spades | Jack of Hearts Ace of Diamond Jack of Spades I 5 of Diamond Queen of Hearts Banker POINTS: 1 IPLAYER POINTS: 7 PLAYER POINTS: Banker POINTS: 8 SSSSSSSSSSSSSSSSSSSSSSSSSSS$$$$$ 5 PLAYER MON 1885 $ $ $$$$$$$$$$$$$$$$$$$$$55555555555 $PLAYER Losss$$$ $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Do you want to play againY/N)? Do you want to play again(Y/N) ?
See Answer
Add Answer +20 Points
Community Answer
YN8XQE The First Answerer
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

Include library   import java.util.Random ;   import java.util.Scanner;   import java.util.InputMismatchException;   //Define class cards   class Cards   {        //Declare variables        private Suits cardSuit;        private int cardNum;   private String[] numString = {"Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};        //Define constructor        public Cards(Suits stype, int snum)        {             //Set card suit             this.cardSuit = stype;             if(snum >=1 && snum <= 13)             this.cardNum = snum;             else             {   System.err.println(snum+" is not a valid card numbern");                 System.exit(1);             }        }        public int lgetCardNumber()        {             return this.cardNum;        }        public String toString()        {   return this.numString[this.cardNum - 1]+" of "+this.cardSuit.toString();        }   }   class Deck   {   // cards in the deck --- arraylist or linkedlist could also be used        private Cards[] cardsInDeck;        private int numOfCardsInDeck;        private int onePack = 52;        public Deck()        {             this(1, true);        }        public Deck(int numPacks, boolean shuffle)        {             this.numOfCardsInDeck = numPacks*this.onePack;             this.cardsInDeck = new Cards[this.numOfCardsInDeck];             int c = 0;             // for each deck             for(int d=0;d<numPacks;d++)             {                 // for each suit                 for(int s=0; s<4;s++)                 {                      // for each number                      for(int n=1;n<=13;n++)                      {   this.cardsInDeck[c] = new Cards(Suits.values()[s], n);                           c++;                      }                 }             }             //shuffle             if(shuffle)             {                 this.lshuffleDeck();             }        }   // custom shuffle function--if <list> was used, it has a shuffle method build in        public void lshuffleDeck()        {             Random rng = new Random();             Cards temp;             // swapping             int j;             for(int li=0; li<this.numOfCardsInDeck;li++)             {                 j = rng.nextInt(this.numOfCardsInDeck);                 temp = this.cardsInDeck[li];                 this.cardsInDeck[li] = this.cardsInDeck[j];                 this.cardsInDeck[j] = temp;             }        }        // Deal card        public Cards dealingNextCard()        {             Cards topCard = this.cardsInDeck[0];             //Remove card                  for(int c =1; c<this.numOfCardsInDeck;c++)             {                 this.cardsInDeck[c-1] = this.cardsInDeck[c];             }             this.cardsInDeck[this.numOfCardsInDeck - 1] = null;             this.numOfCardsInDeck--;             return topCard;        }        public void printDeckCards(int num)        {             for(int c=0; c<num; c++)             {   System.out.printf("% 3d/%d %sn", c+1, this.numOfCardsInDeck, this.cardsInDeck[c].toString());             }   System.out.printf("tt[%d other]n", this.numOfCardsInDeck - num);        }   }   public class TestBlackJack   {        private Deck lnewDeck;        private String lplayerName;        private float lbalance;        private float lbet;        private boolean lyouDone;        private boolean ldealerDone;        private Players ldealer;        private Players lyou;        private Scanner lsc = new Scanner(System.in);        private boolean ldoubleDownAllowed;        TestBlackJack(String lpName)        {             this.lbalance = 100;             this.lnewDeck = new Deck(4, true);             boolean lgameOver = false;             this.lplayerName = lpName;   System.out.println("######################################################################################");   System.out.println("# Congratulations!! "+this.lplayerName+", you have got 100 points!!!!!!!!!!!!!!!!!!! #");   System.out.println("######################################################################################");             // Players init             lyou = new Players(this.lplayerName);             ldealer = new Players("Dealer");             // Start game             while(this.lbalance > 0 && !lgameOver)             {   System.out.println("n"+this.lplayerName+", DEAL or END the game [D or E]??");                 String gameInit = lsc.next();                 if(gameInit.compareToIgnoreCase("D") == 0)                 {                      this.ldealTheGame();                              }                 else                 {                      lgameOver = true;                 }                }   System.out.println("n"+this.lplayerName+", !!!! Game Ended !!!");             // Play again   System.out.println("n"+this.lplayerName+", Play again ??[Y or N]");             String Y = lsc.next();             if(Y.compareToIgnoreCase("Y") == 0)             {                 new TestBlackJack(this.lplayerName);             }             //closing lscan             lsc.close();        }        // Define ldealTheGame()        private void ldealTheGame()        {             boolean lblackjack = false;             this.lbet = 0 ;             this.ldoubleDownAllowed = true;             System.out.printf("nBalance:$%.1fn", this.lbalance);             String msg = "Enter bet for game :";             while(this.lbet<=0)             {                 try                 {                      System.out.println("n"+msg);                      this.lbet = lsc.nextFloat();                 }                 catch(InputMismatchException e)                 {                      lsc.nextLine();                 }                 finally                 {                      msg = "Enter bet in integers:";                 }                }   if((this.lbet >= 1) && (this.lbet%1 == 0) && (this.lbalance-this.lbet>=0))        {             this.lbalance = this.lbalance - this.lbet;             // Call emptyHand()             lyou.emptyHand();             ldealer.emptyHand();             this.lyouDone = false;             this.ldealerDone = false;             // Distribute cards             lyou.addCardToPlayersHand(lnewDeck.dealingNextCard());                                               ldealer.addCardToPlayersHand(lnewDeck.dealingNextCard());             lyou.addCardToPlayersHand(lnewDeck.dealingNextCard());                            ldealer.addCardToPlayersHand(lnewDeck.dealingNextCard());             // Dealt cards   System.out.println("n########## CARDS DEALT ##########n");             ldealer.printCardsInHand(false);             lyou.printCardsInHand(true);   System.out.printf("Your Score:%dt", lyou.lgetPlayersHandTotal());             System.out.printf("Bet:$%.0ft", this.lbet);             System.out.printf("Balance:$%.1fnn", this.lbalance);             // check initial card state             lblackjack = this.lcheckIfBlackJack();             while(!this.lyouDone || !this.ldealerDone)             {                 if(!this.lyouDone)                 {                      this.lyourPlay();                 }                 else if(!this.ldealerDone)                 {                      this.ldealersPlay();                 }                 System.out.println();             }             if(!lblackjack)             {                 this.ldecideWinner();                    }           }        else        {   System.out.println("n Wrong bet amount, should not be more than balance");   System.out.printf("Your Balance:$%.1fnn", this.lbalance);        }   }   // Define lcheckIfBlackJack()   private boolean lcheckIfBlackJack()   {        boolean lblackJack = false;        if(lyou.lgetPlayersHandTotal() == 21)        {             this.lyouDone = true;             this.ldealerDone = true;   if(lyou.lgetPlayersHandTotal() > ldealer.lgetPlayersHandTotal() || ldealer.lgetPlayersHandTotal() > 21)             {                  System.out.println("tttt#################################");   System.out.println("tttt# #");   System.out.println("tttt# HURRAY!!...BLACKJACK, YOU WON #");   System.out.println("tttt# #");   System.out.println("tttt#################################n");                 ldealer.printCardsInHand(true);   System.out.printf("Dealer's Score:%dnn", ldealer.lgetPlayersHandTotal());   System.out.printf("Your Bet was :$%.0ft", this.lbet);   System.out.printf("Your Balance was:$%.1fn", this.lbalance);   System.out.printf("You win[3:2]:$%.1ft", (3*this.lbet)/2);   this.lbalance = this.lbalance + (3*this.lbet)/2 + this.lbet;   System.out.printf("Your Current Bal ... See the full answer