rite a program that allows for me to play Blackjack. When the program starts the should be prompted with a menu with three choices (1) Play blackjack; (2) View e history; (3) Quit game. d on each of these options the following will need to occur: Quit game: A "Thank you" for playing message along with the balance that the user has should be displayed and the program should end. Play blackjack: This option will allow for the user to play blackjack. In addition to playing the game of blackjack when the "hand" is done it needs to write a summary to a file called LastNameHistory.txt. This file should contain the following information with appropriate output formatting: Dealer W/L The instructions and guidelines for setting up and playing blackjack are found below. View game history: This option should read in the LastNameHistory.txt file that your program has written (be sure that when your program is done writing to the file that you close it so that it can be opened for reading), and display its contents to the screen for the user to see.
In the case that the user has not yet played a hand of blackjack, the file to read in should not exist and the program should provide the user with a message that there is no history and display the menu again so that the user can choose to quit or play the game. Playing Blackjack: The game will take place between the user and the dealer. The first thing that needs to be done is for the user to "place a bet". To do this we will need two pieces of information from the user (1) how much they have "credit" for (this is the maximum that they are able to spend unless they win from the table), and (2) how much they want to bed. The table has a minimum bet of 10 and a maximum bet of 150. Once the bet is placed the dealer will first deal a card to the user, then a card to him/herself HOWEVER the value of the first dealer card is NOT shown at this time. A second card is dealt to the user and the dealer. At this point the user will need to decide whether to hit or stay, unless they get a Blackjack. If the user gets a blackjack on the second card, then the dealer will need to reveal his/her first card along with their second. If the dealer does not have blackjack the user wins the hand. If the dealer also has blackjack, then it's a push and no money is lost for the user or the house. With BLACKJACK the user should not be asked to hit or stay. If the user chooses to hit, then the dealer will deal another card to the user. As long as the user has not "busted" (where the cards add up to more than 21), then he or she will need to decide whether to hit or stay again. The user may be dealt up to 3 cards, if the user reaches the 3rd card that will be the hand that he/she will have to play against the dealer. If the user "hits" and "busts" then the user loses his/her bet, the dealer's first card is then revealed to show what he/she had.
If the user chooses to stay, then the dealer will reveal his/her first card. If the two cards from the dealer adds up to 17 then the dealer cannot "hit". If the user has higher than 17 he/she wins the hand, if not they lose and the house wins. If the two cards from the dealer does not add up to 17 then the dealer will be dealt a \( 3^{\text {rd }} \) card (this is not the normal in the game of Blackjack, but if we play normal you will have thousands lines of code). Example, user hand is showing 19. Dealers first 2 cards add up to 12 , this is less than 17 so the dealer MUST be dealt another card. If the dealer gets a 6 that will put him/her at 18 and the user wins. If the dealer is dealt a 7 , then it's a "push" and neither the house or user wins. If the dealer is dealt a 8 or 9 then the dealer wins and the user loses. If the dealer is dealt a 10 or higher than the dealer busts and the user wins. If the user loses the bet, then the amount that he/she bet should be deducted from his/her credit. If the user wins then he/she should receive the amount back that he/she just bet plus the same amount from the house. So if the user bets \( \$ 50 \) and wins, then \( \$ 100 \) should be added to his/her credit.