Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Will upvote as well. where can I find problem statement? Assignment Instructions 1. Use only Eclipse IDE (Only JDK 8 or 11). 2. The due
Will upvote as well.
where can I find problem statement?
Assignment Instructions 1. Use only Eclipse IDE (Only JDK 8 or 11). 2. The due date for this assignment is posted in D2L. The Problem In this assignment you will implement a game called Punto Banco. Your software will also save stats and balances for each player, and allow a user to generate reports based on this data. New players will be given a starting balance at their first game, and returning players will continue with their previous balance. The program must have the following features: 1. Data Storage: - Player information is stored in the text file res/Casinoinfo.txt Each row of text stores data for one player, formatted as "name, balance, numberofwins" - for example: Khosro, 100,21 - If the text file does not exist at startup, your program must create it. - Player data must be saved back to the text file when the program ends - that file serves as a sort of database. - When the program starts, the player data in res/Casino Info. txt must be loaded into an arrayList of Player objects 2. Menus and Navigation Note: The program should treat all user input as case-insensitive, and all menus should display an error message and re-prompt if an invalid input is entered. - At startup, the program must present a main menu as follows: - (P) Play Game: This option lunches the Punto Banco game. The rules will be explained later. - (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: 1 (T) Top player: This option shows the player(s) with most wins and returns to the main menu after the user presses "Enter": - (N) Search for a Name: This option prompts the user for a name, and displays that player's information if they exist in the database. The user is informed if that player is not in the database. Returns to the main menu after pressing "Enter". (N) Search for a Name: This option prompts the user for a name, and displays that player's information if they exist in the database. The user is informed if that player is not in the database. Returns to the main menu after pressing "Enter". (B) Back to main menu: This option will take the user to the main menu - (E) Exit: This option in the main menu ends the program. All player data must be saved before the program ends. Punto Banco Game Rules Punto Banco is a casino game between a player and banker. It plays out automatically according to fixed rules. That is, the player makes no decisions during the game; they simply bet on the player, banker, or a tie. Hands are scored by summing the card values, 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 . 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 follows this algorithm: 1. The player and banker are each dealt 2 cards face-up (your program must print both hands on the screen, clearly marking each) 2. If the Player or Banker has a total of 8 or 9 , no more cards are dealt (skip to step 5) 3. If the Player has a total of 0-5, the player gets a third card face-up 4. The banker may draw a third card, based on the following logic: - If the player did not draw a third card, the banker draws if his hand totals 0-5, but stands if the total is 6-7 - If the player's third card was a 2 or 3 , the banker draws if his hand totals 04, but stands if the total is 5-7 - If the player's third card was a 4 or 5 , the banker draws if his hand totals 05, but stands if the total is 6-7 - If the player's third card was a 6 or 7 , the banker draws if his hand totals 0-6, but stands if the total is 7 - If the player's third card was a 8, the banker draws if his hand totals 02, but stands if the total is 37 - If the player's third card was Ace, 9,10 , or a face card, the banker draws if his hand totals 0 3 , but stands if the total is 4-7 5. Both hands are scored and the highest-point-value wins (ties are possible). 6. A successful bet on either the player or banker wins the bet amount. A successful bet on a tie wins 5-to-1 ( 5x the bet amount). An unsuccessful bet is lost (deducted from the player's balance) Card Deck: A fresh deck of 52 cards (represented as a software object) should be created and shuffled when the program starts. The same deck object should be used (even across games) until it runs out of cards, at which point it should be reset (all 52 cards restored and shuffled). Punto Banco User Interface 1. Upon launching the game (from the main menu) the user is asked for their name: - If the user already exists in the database, a welcome back message is shown as follows: What is your name: khosro If the user is new, we create a new account with initial balance of $100 : What is your name:John - If the player has a balance of 0 , they cannot play and are returned to the main menu. 2. The user is then asked which outcome they would like to bet on, and the bet amount: 3. The player cannot bet more than their current balance. 4. The game then plays out, the result determined, and the player's balance is adjusted accordingly. 5. The player is asked if they would like to play again, or return to the main menu. If they choose to play again, they return to the betting menu (step 2). Two sample outputs of the game: Two sample outputs of the game: Some points about the game - Before each game starts, a new deck(s) of cards should be created and shuffled before use. - When a game is selected to play, the user will be able to keep playing the game until they chose to exit and return to the main menu. - During the execution of a single game (even when repeating) the same deck of cards should be used. Only when all cards run out should a new deck be created and shuffled. Automated Testing We expect to see reasonable JUnit tests to ensure the behavior of the existing classes (Card, Deck, Player, ...) is as expected. Few example, we would expect your tests to: - Ensure you can create a card and get its suit, rank and correct string representation (especially for Jack, Queen, King, Ace) - Ensure you can create a hand of cards, add cards to it, and compute its score - Create a new deck of cards and shuffle it (and get a different arrangement of cards each time) - Does the deck behave as expected when the last card is drawn? - Additionally, any public method you create which does not require user input to function should also have a JUnit test. Runnable Jar file - Generate a runnable jar for your project (inside the project folder) Documentation - Javadoc files must be generated in the doc folder. Some points about the game - Before each game starts, a new deck(s) of cards should be created and shuffled before use. - When a game is selected to play, the user will be able to keep playing the game until they chose to exit and return to the main menu. - During the execution of a single game (even when repeating) the same deck of cards should be used. Only when all cards run out should a new deck be created and shuffled. Automated Testing We expect to see reasonable JUnit tests to ensure the behavior of the existing classes (Card, Deck, Player, ...) is as expected. Few example, we would expect your tests to: - Ensure you can create a card and get its suit, rank and correct string representation (especially for Jack, Queen, King, Ace) - Ensure you can create a hand of cards, add cards to it, and compute its score - Create a new deck of cards and shuffle it (and get a different arrangement of cards each time) - Does the deck behave as expected when the last card is drawn? - Additionally, any public method you create which does not require user input to function should also have a JUnit test. Runnable Jar file - Generate a runnable jar for your project (inside the project folder) Documentation - Javadoc files must be generated in the doc project folder. - Reasonable in-line comments (single or multi-line) should be provided Starter Code - You have been provided a starter code (skeleton) with the basic project structure and some of the classes' code. Complete the code to meet the requirements above. You can add new classes \& code as necessary, but you must not change the basic structure. All classes and methods in the starter code must work as described in the starter code. Submission Instruction 1. Push all git commits before the due date. The contribution of each team member must be visible in Git history. Paste the link to your github repo into the D2L assignment to finalize your submission. 2. You MUST demo your project to your instructor during a demonstration to be scheduled during tutorial/lab time. This demo is mandatory. No demo = a grade of 0 Assignment Instructions 1. Use only Eclipse IDE (Only JDK 8 or 11). 2. The due date for this assignment is posted in D2L. The Problem In this assignment you will implement a game called Punto Banco. Your software will also save stats and balances for each player, and allow a user to generate reports based on this data. New players will be given a starting balance at their first game, and returning players will continue with their previous balance. The program must have the following features: 1. Data Storage: - Player information is stored in the text file res/Casinoinfo.txt Each row of text stores data for one player, formatted as "name, balance, numberofwins" - for example: Khosro, 100,21 - If the text file does not exist at startup, your program must create it. - Player data must be saved back to the text file when the program ends - that file serves as a sort of database. - When the program starts, the player data in res/Casino Info. txt must be loaded into an arrayList of Player objects 2. Menus and Navigation Note: The program should treat all user input as case-insensitive, and all menus should display an error message and re-prompt if an invalid input is entered. - At startup, the program must present a main menu as follows: - (P) Play Game: This option lunches the Punto Banco game. The rules will be explained later. - (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: 1 (T) Top player: This option shows the player(s) with most wins and returns to the main menu after the user presses "Enter": - (N) Search for a Name: This option prompts the user for a name, and displays that player's information if they exist in the database. The user is informed if that player is not in the database. Returns to the main menu after pressing "Enter". (N) Search for a Name: This option prompts the user for a name, and displays that player's information if they exist in the database. The user is informed if that player is not in the database. Returns to the main menu after pressing "Enter". (B) Back to main menu: This option will take the user to the main menu - (E) Exit: This option in the main menu ends the program. All player data must be saved before the program ends. Punto Banco Game Rules Punto Banco is a casino game between a player and banker. It plays out automatically according to fixed rules. That is, the player makes no decisions during the game; they simply bet on the player, banker, or a tie. Hands are scored by summing the card values, 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 . 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 follows this algorithm: 1. The player and banker are each dealt 2 cards face-up (your program must print both hands on the screen, clearly marking each) 2. If the Player or Banker has a total of 8 or 9 , no more cards are dealt (skip to step 5) 3. If the Player has a total of 0-5, the player gets a third card face-up 4. The banker may draw a third card, based on the following logic: - If the player did not draw a third card, the banker draws if his hand totals 0-5, but stands if the total is 6-7 - If the player's third card was a 2 or 3 , the banker draws if his hand totals 04, but stands if the total is 5-7 - If the player's third card was a 4 or 5 , the banker draws if his hand totals 05, but stands if the total is 6-7 - If the player's third card was a 6 or 7 , the banker draws if his hand totals 0-6, but stands if the total is 7 - If the player's third card was a 8, the banker draws if his hand totals 02, but stands if the total is 37 - If the player's third card was Ace, 9,10 , or a face card, the banker draws if his hand totals 0 3 , but stands if the total is 4-7 5. Both hands are scored and the highest-point-value wins (ties are possible). 6. A successful bet on either the player or banker wins the bet amount. A successful bet on a tie wins 5-to-1 ( 5x the bet amount). An unsuccessful bet is lost (deducted from the player's balance) Card Deck: A fresh deck of 52 cards (represented as a software object) should be created and shuffled when the program starts. The same deck object should be used (even across games) until it runs out of cards, at which point it should be reset (all 52 cards restored and shuffled). Punto Banco User Interface 1. Upon launching the game (from the main menu) the user is asked for their name: - If the user already exists in the database, a welcome back message is shown as follows: What is your name: khosro If the user is new, we create a new account with initial balance of $100 : What is your name:John - If the player has a balance of 0 , they cannot play and are returned to the main menu. 2. The user is then asked which outcome they would like to bet on, and the bet amount: 3. The player cannot bet more than their current balance. 4. The game then plays out, the result determined, and the player's balance is adjusted accordingly. 5. The player is asked if they would like to play again, or return to the main menu. If they choose to play again, they return to the betting menu (step 2). Two sample outputs of the game: Two sample outputs of the game: Some points about the game - Before each game starts, a new deck(s) of cards should be created and shuffled before use. - When a game is selected to play, the user will be able to keep playing the game until they chose to exit and return to the main menu. - During the execution of a single game (even when repeating) the same deck of cards should be used. Only when all cards run out should a new deck be created and shuffled. Automated Testing We expect to see reasonable JUnit tests to ensure the behavior of the existing classes (Card, Deck, Player, ...) is as expected. Few example, we would expect your tests to: - Ensure you can create a card and get its suit, rank and correct string representation (especially for Jack, Queen, King, Ace) - Ensure you can create a hand of cards, add cards to it, and compute its score - Create a new deck of cards and shuffle it (and get a different arrangement of cards each time) - Does the deck behave as expected when the last card is drawn? - Additionally, any public method you create which does not require user input to function should also have a JUnit test. Runnable Jar file - Generate a runnable jar for your project (inside the project folder) Documentation - Javadoc files must be generated in the doc folder. Some points about the game - Before each game starts, a new deck(s) of cards should be created and shuffled before use. - When a game is selected to play, the user will be able to keep playing the game until they chose to exit and return to the main menu. - During the execution of a single game (even when repeating) the same deck of cards should be used. Only when all cards run out should a new deck be created and shuffled. Automated Testing We expect to see reasonable JUnit tests to ensure the behavior of the existing classes (Card, Deck, Player, ...) is as expected. Few example, we would expect your tests to: - Ensure you can create a card and get its suit, rank and correct string representation (especially for Jack, Queen, King, Ace) - Ensure you can create a hand of cards, add cards to it, and compute its score - Create a new deck of cards and shuffle it (and get a different arrangement of cards each time) - Does the deck behave as expected when the last card is drawn? - Additionally, any public method you create which does not require user input to function should also have a JUnit test. Runnable Jar file - Generate a runnable jar for your project (inside the project folder) Documentation - Javadoc files must be generated in the doc project folder. - Reasonable in-line comments (single or multi-line) should be provided Starter Code - You have been provided a starter code (skeleton) with the basic project structure and some of the classes' code. Complete the code to meet the requirements above. You can add new classes \& code as necessary, but you must not change the basic structure. All classes and methods in the starter code must work as described in the starter code. Submission Instruction 1. Push all git commits before the due date. The contribution of each team member must be visible in Git history. Paste the link to your github repo into the D2L assignment to finalize your submission. 2. You MUST demo your project to your instructor during a demonstration to be scheduled during tutorial/lab time. This demo is mandatory. No demo = a grade of 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started