Question
Please help with this in Java code! I need your help. I also need help with the pseudocode! Please also write down the pseudocode! I
Please help with this in Java code! I need your help.
I also need help with the pseudocode!
Please also write down the pseudocode! I really appreciated it.
Please do not use the code paste by the same question in Chegg.
(It may be helpful to create a class to store the game information. For instance, you could create a class called CrapsRound that holds the first roll, point, result of the round, and a toString method that prints the round information in the correct format. Then you can create a class that holds an array of CrapsRound objects to simulate running many rounds.)
Write a simulation of the Craps dice game. Craps is a dice game that revolves around rolling two six-sided dice in an attempt to roll a particular number. Wins and losses are determined by rolling the dice. This assignment gives practice for: printing, loops, variables, if-statements or switch statements, generating random numbers, methods, and classes. Craps game rules: First roll: The first roll ("come-out roll) wins if the total is a 7 or 11. The first roll loses if the total is a 2, 3, or 12 ("craps). If any of these five numbers is rolled on the first roll, tally the win or loss, and the round is over. If none of the above is rolled on a first roll, then the total rolled is saved as the point, i.e. a "point" is established. Subsequent rolls: Continue rolling the dice until either a 7 is rolled or the point is rolled i.e. the round is over. For those rolls, if the point is rolled before a 7, then tally a win. If a 7 is rolled before the point, tally a loss. Program specifications: 1) Run 100,000 rounds. 2) Print out information about each round. 3) Keep track of the wins and losses for all rounds played. 4) Print out the round information for the first 10 rounds. 5) Print out the total number of round wins and losses over 100,000 rounds. Page 1 of 5 See Appendix 1 for sample output. Your output should match exactly as shown on the next page. Hints: Come up the main logic for the game in your pseudocode. Step through your pseudocode as if the program was running to see if it works. After you've gotten this working, put this code in a loop and check it for 2 rounds. Write the java code for your pseudocode. Test it for ten or twenty rounds, keeping track of the number of wins and losses, and printing out the total wins and losses at the end. After that, the final touch will be to make the detailed round printing, and then only printing the first ten rounds. Then you can increase the total rounds played to 100,000, and you're done! It may be helpful to create a class to store the game information. For instance, you could create a class called CrapsRound that holds the first roll, point, result of the round, and a toString method that prints the round information in the correct format. Then you can create a class that holds an array of CrapsRound objects to simulate running many rounds. Coding Style This grade is awarded for proper coding style. This includes: Your name in comments at the top of every Java file you edit Proper indentation Good within method commenting (explains what code is doing) Well-organized, elegant solutions for each part To Do: 1) Write the pseudocode to accomplish the craps game in a text file, named LastName_Assignment1_Pseudocode.txt. For example, my submission would be Ibitoye_Assignment1_Pseudocode.txt. 2) Create a project in NetBeans called Assignment1. Write the java code, based on your Page 2 of 5 pseudocode to accomplish the craps game in NetBeans. 3) Test your program to make sure it works properly. Sample output below. Note: Your output should match the sample. 4) Export your project to a zipped file. Files to submit: Your project file submitted as a NetBeans zip file, Assignment1.zip. This is not the same as a regular zip file. You create this file from NetBeans. First select the project you want to export, then go to File Export Project To ZIP... In the window that pops up don't change the Root Project line. On the Build ZIP: line you can browse to the directory where you want your zip file to be stored but you'll have to enter the filename yourself. Be sure to use the complete name of your project as the file name. If you do not submit a NetBeans zip file you will receive a zero on this Assignment. . Your text file containing your pseudocode, LastName_Assignment1_Pseudocode.txt Appendix 1 Round 1 Roll 1 -- Die2: 5 -- Total: 10 Point is 10 Round 1 Roll 2 Diel: 5, Die2: 1 -- Total: 6 Round 1 Roll 3 -- Diel: 6, Die2: 6 -- Total: 12 Round 1 Roll 4 -- Diel: 2, Die2: 4 -- Total: 6 Round 1 Roll 5 -- Dier: 2, Die2: 5 -- Total: 7 LOSS! 1 losses Round 2, Roll 1 -- Diel: 1 WIN! Die2: 6 -- Total: 7 1 losses 3, Die2: 5 -- Total: 8 Round 3 Point is Round 3 WIN! 2 wins Roll 1 -- Diel: 8 Roll 2 -- Diel: 3, Die2: 5 -- Total: 1 losses Round 4 Roll 1 -- Diet: 6, Die2: 4 -- Total: 10 Point is 10 Page 3 of 5 Roll 2 -- Diel: 6, Die2: 1 -- Total: 7 Round 4 LOSS! 2 wins 2 losses Round 5 Point is Round 5 WIN! 3 wins Boll 1 -- Diel: 1, Die2: 4 -- Total: 5 Roll 2 -- Diel: 1 Die2: 4 -- Total: 5 2 losses Round 6, Roll 1 -- Diel: 2, Die2: 5 -- Total: 7 WIN! 4 wins 2 losses Round 7 Roll 1 -- Diel: 1, Die2: $ -- Total: Point is a Round 7 LOSS! Roll 2 -- Diet: 2 Die2: 8 Total: 3 losses Roll 1 -- Diel: 3, Die2: 3 Total: 6 Round Point 13 Round 8 Round 8 Round 8 Round 8 WIN! Roll 2 -- Dies: 3 Die2: 2 -- Total: 5 2011 3 -- Diet: 4, Die2: E -- Total: 10 Roll 4 -- Diet: 6, Die2: 3 -- Total: 9 Roll 5 -- Diel: 4, Die2: 2 -- Total: 6 5 win(s), 3 lossles) Round 9, Boll 1 -- Diet: 3, Die2: 4 -- Total: 7 WIN! 3 losses) Round 10 Roli i -- Diel: 5, Die2: 3 -- Tocal: Point is 8 Round 10, Roll 2 -- Diel: 4 WIN! Die2: 4 -- Total: 8 7 wins 3 loss(es) OVERALL: Page 4 of 5 49156 wins 50944 losses Page 5 of 5 Write a simulation of the Craps dice game. Craps is a dice game that revolves around rolling two six-sided dice in an attempt to roll a particular number. Wins and losses are determined by rolling the dice. This assignment gives practice for: printing, loops, variables, if-statements or switch statements, generating random numbers, methods, and classes. Craps game rules: First roll: The first roll ("come-out roll) wins if the total is a 7 or 11. The first roll loses if the total is a 2, 3, or 12 ("craps). If any of these five numbers is rolled on the first roll, tally the win or loss, and the round is over. If none of the above is rolled on a first roll, then the total rolled is saved as the point, i.e. a "point" is established. Subsequent rolls: Continue rolling the dice until either a 7 is rolled or the point is rolled i.e. the round is over. For those rolls, if the point is rolled before a 7, then tally a win. If a 7 is rolled before the point, tally a loss. Program specifications: 1) Run 100,000 rounds. 2) Print out information about each round. 3) Keep track of the wins and losses for all rounds played. 4) Print out the round information for the first 10 rounds. 5) Print out the total number of round wins and losses over 100,000 rounds. Page 1 of 5 See Appendix 1 for sample output. Your output should match exactly as shown on the next page. Hints: Come up the main logic for the game in your pseudocode. Step through your pseudocode as if the program was running to see if it works. After you've gotten this working, put this code in a loop and check it for 2 rounds. Write the java code for your pseudocode. Test it for ten or twenty rounds, keeping track of the number of wins and losses, and printing out the total wins and losses at the end. After that, the final touch will be to make the detailed round printing, and then only printing the first ten rounds. Then you can increase the total rounds played to 100,000, and you're done! It may be helpful to create a class to store the game information. For instance, you could create a class called CrapsRound that holds the first roll, point, result of the round, and a toString method that prints the round information in the correct format. Then you can create a class that holds an array of CrapsRound objects to simulate running many rounds. Coding Style This grade is awarded for proper coding style. This includes: Your name in comments at the top of every Java file you edit Proper indentation Good within method commenting (explains what code is doing) Well-organized, elegant solutions for each part To Do: 1) Write the pseudocode to accomplish the craps game in a text file, named LastName_Assignment1_Pseudocode.txt. For example, my submission would be Ibitoye_Assignment1_Pseudocode.txt. 2) Create a project in NetBeans called Assignment1. Write the java code, based on your Page 2 of 5 pseudocode to accomplish the craps game in NetBeans. 3) Test your program to make sure it works properly. Sample output below. Note: Your output should match the sample. 4) Export your project to a zipped file. Files to submit: Your project file submitted as a NetBeans zip file, Assignment1.zip. This is not the same as a regular zip file. You create this file from NetBeans. First select the project you want to export, then go to File Export Project To ZIP... In the window that pops up don't change the Root Project line. On the Build ZIP: line you can browse to the directory where you want your zip file to be stored but you'll have to enter the filename yourself. Be sure to use the complete name of your project as the file name. If you do not submit a NetBeans zip file you will receive a zero on this Assignment. . Your text file containing your pseudocode, LastName_Assignment1_Pseudocode.txt Appendix 1 Round 1 Roll 1 -- Die2: 5 -- Total: 10 Point is 10 Round 1 Roll 2 Diel: 5, Die2: 1 -- Total: 6 Round 1 Roll 3 -- Diel: 6, Die2: 6 -- Total: 12 Round 1 Roll 4 -- Diel: 2, Die2: 4 -- Total: 6 Round 1 Roll 5 -- Dier: 2, Die2: 5 -- Total: 7 LOSS! 1 losses Round 2, Roll 1 -- Diel: 1 WIN! Die2: 6 -- Total: 7 1 losses 3, Die2: 5 -- Total: 8 Round 3 Point is Round 3 WIN! 2 wins Roll 1 -- Diel: 8 Roll 2 -- Diel: 3, Die2: 5 -- Total: 1 losses Round 4 Roll 1 -- Diet: 6, Die2: 4 -- Total: 10 Point is 10 Page 3 of 5 Roll 2 -- Diel: 6, Die2: 1 -- Total: 7 Round 4 LOSS! 2 wins 2 losses Round 5 Point is Round 5 WIN! 3 wins Boll 1 -- Diel: 1, Die2: 4 -- Total: 5 Roll 2 -- Diel: 1 Die2: 4 -- Total: 5 2 losses Round 6, Roll 1 -- Diel: 2, Die2: 5 -- Total: 7 WIN! 4 wins 2 losses Round 7 Roll 1 -- Diel: 1, Die2: $ -- Total: Point is a Round 7 LOSS! Roll 2 -- Diet: 2 Die2: 8 Total: 3 losses Roll 1 -- Diel: 3, Die2: 3 Total: 6 Round Point 13 Round 8 Round 8 Round 8 Round 8 WIN! Roll 2 -- Dies: 3 Die2: 2 -- Total: 5 2011 3 -- Diet: 4, Die2: E -- Total: 10 Roll 4 -- Diet: 6, Die2: 3 -- Total: 9 Roll 5 -- Diel: 4, Die2: 2 -- Total: 6 5 win(s), 3 lossles) Round 9, Boll 1 -- Diet: 3, Die2: 4 -- Total: 7 WIN! 3 losses) Round 10 Roli i -- Diel: 5, Die2: 3 -- Tocal: Point is 8 Round 10, Roll 2 -- Diel: 4 WIN! Die2: 4 -- Total: 8 7 wins 3 loss(es) OVERALL: Page 4 of 5 49156 wins 50944 losses Page 5 of 5
Step 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