Assignment4A: Let's Play Bunco! Now that we are able to repeat actions easily with loops, we...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assignment4A: Let's Play Bunco! Now that we are able to repeat actions easily with loops, we can program a wide variety of traditional games like Poker and BlackJack. For this assignment, we are going to create a simplified version of the dice game Bunco. The real game involves multiple players rolling dice and trying to get the highest score at the end of the round. For our assignment, we'll just have two players - you and the computer. Each game will run for no more than 6 rounds. The player and the computer will "roll" their two dice (represented by two integer variables per player). Each dice roll will be simulated by a random number generator that produces a random number between 1 and 6. Once all four integer values are generated, a score will be calculated for each player using these rules: Result Both dice match the current round number Both dice match each other, but not the round One dice matches the current round number Anything else Points 21 points + the sum of the two dice 5 points + the sum of the two dice 1 point + the sum of the two dice The sum of the two dice For example, if the player rolls a 1 and 2 on the first round, their score would be 4 (one bonus point for one dice matching the round number, then the value of the dice added together). If the computer rolls 2 and 2, then its score would be 9 (five bonus points for both dice matching each other but not the round number, then the value of the dice added together). After each round, the player is given the option to stop. If they choose to do so (or if six rounds have been played), their current score is compared against the computer's current score and a winner is declared. Then the player is asked if they'd like to play again, restarting the whole process. Hints: Rounds could also be thought of as "loop iterations". One particular looping structure could easily provide us with the round number for comparison and a way to limit the number of rounds played automatically. Call the file Assignment4A (.java, .cs, .cpp) and the class name Assignment4A. Two examples of gameplay are shown below. Note that due to using a random number generator, you may not get the same numerical results - but the formatting and wording should be the same. User input is indicated in bold. Sample Output #1: Let's play Bunco! Round 1: You rolled 1 and 5. Your score is 7. Do you want to stop?: N Round 2: You rolled 3 and 3. Your score is 11. Do you want to stop?: Y Okay, the computer's score is... 41 You win! Do you want to play again?: N Game Over... Sample Output #2: Let's play Bunco! Round 1: You rolled 2 and 4. Your score is 6. Do you want to stop?: Y Okay, the computer's score is... 23! Sorry, you lose. Do you want to play again?: Y Let's play Bunco! Round 1: You rolled 1 and 1. Your score is 23. Do you want to stop?: N //Rest of iterations go here (do not print this line!) Round 6: You rolled 5 and 5. Your score is 15. You've played all six rounds Okay, the computer's score is... 7! You win! Do you want to play again?: N Game Over... Assignment4A: Let's Play Bunco! Now that we are able to repeat actions easily with loops, we can program a wide variety of traditional games like Poker and BlackJack. For this assignment, we are going to create a simplified version of the dice game Bunco. The real game involves multiple players rolling dice and trying to get the highest score at the end of the round. For our assignment, we'll just have two players - you and the computer. Each game will run for no more than 6 rounds. The player and the computer will "roll" their two dice (represented by two integer variables per player). Each dice roll will be simulated by a random number generator that produces a random number between 1 and 6. Once all four integer values are generated, a score will be calculated for each player using these rules: Result Both dice match the current round number Both dice match each other, but not the round One dice matches the current round number Anything else Points 21 points + the sum of the two dice 5 points + the sum of the two dice 1 point + the sum of the two dice The sum of the two dice For example, if the player rolls a 1 and 2 on the first round, their score would be 4 (one bonus point for one dice matching the round number, then the value of the dice added together). If the computer rolls 2 and 2, then its score would be 9 (five bonus points for both dice matching each other but not the round number, then the value of the dice added together). After each round, the player is given the option to stop. If they choose to do so (or if six rounds have been played), their current score is compared against the computer's current score and a winner is declared. Then the player is asked if they'd like to play again, restarting the whole process. Hints: Rounds could also be thought of as "loop iterations". One particular looping structure could easily provide us with the round number for comparison and a way to limit the number of rounds played automatically. Call the file Assignment4A (.java, .cs, .cpp) and the class name Assignment4A. Two examples of gameplay are shown below. Note that due to using a random number generator, you may not get the same numerical results - but the formatting and wording should be the same. User input is indicated in bold. Sample Output #1: Let's play Bunco! Round 1: You rolled 1 and 5. Your score is 7. Do you want to stop?: N Round 2: You rolled 3 and 3. Your score is 11. Do you want to stop?: Y Okay, the computer's score is... 41 You win! Do you want to play again?: N Game Over... Sample Output #2: Let's play Bunco! Round 1: You rolled 2 and 4. Your score is 6. Do you want to stop?: Y Okay, the computer's score is... 23! Sorry, you lose. Do you want to play again?: Y Let's play Bunco! Round 1: You rolled 1 and 1. Your score is 23. Do you want to stop?: N //Rest of iterations go here (do not print this line!) Round 6: You rolled 5 and 5. Your score is 15. You've played all six rounds Okay, the computer's score is... 7! You win! Do you want to play again?: N Game Over...
Expert Answer:
Answer rating: 100% (QA)
Before diving into the coding part lets discuss some prerequisite concepts that will help in underst... View the full answer
Related Book For
Managerial Accounting An Introduction to Concepts Methods and Uses
ISBN: 978-0324639766
10th Edition
Authors: Michael W. Maher, Clyde P. Stickney, Roman L. Weil
Posted Date:
Students also viewed these programming questions
-
The Georgeville city government provides a wide variety of services to the community. Among them is the protection provided by the police force. In order to provide that force it spends $ 3 million...
-
The allometric formula is used to describe a wide variety of growth patterns. It says that y = nxm, where x and y are variables, and n and m are constants. For example, the famous biologist J. S....
-
With randomization techniques we are able to analyze any statistic we desire. What if we wanted to look at whether the median lifespan of men with children was higher than men without children? Using...
-
It is proposed to use water instead of refrigerant-134a as the working fluid in air-conditioning applications where the minimum temperature never falls below the freezing point. Would you support...
-
To identify instances of sexual harassment, the courts may use a "reasonable woman" standard of what constitutes offensive behavior. This standard is based on the idea that women and men have...
-
Given a 3 year 10% coupon Government Bond issued on January 1st, 2010 and the following Zero Coupon Curve which is 10 basis points above the initial one and being today April 1 st , 2010 April 1st...
-
Derive the general solution for \(\psi\) given in the text (Eq. (15.9)). 0 (r,n) = A++ Bnr "+1 + Cnr -" + Dnr"1Qn(n) 2-n (15.9) n=1
-
Prepare the 2016 fiduciary income tax return (Form 1041) for the Green Trust. In addition, determine the amount and character of the income and expense items that each beneficiary must report for the...
-
Tech Solutions is a consulting firm that uses a job-order costing system. Its direct materials consist of hardware and software that it purchases and installs on behalf of its clients. The firm's...
-
Variable and fixed costs, profitability of order, opportunity cost Healthy Hearth specializes in lunches for health-conscious people. The company produces a small selection of lunch offerings each...
-
The instruction: 1) You need to find ONE (1) Multinational Company (MNC) with their subsidiaries worldwide. Distinguish the country in the world map 2) Analyze the labour law practice by the MNE(the...
-
Bowie and Velasquez discussed ethical issues, which are uncertainties and the ability to execute a project during decision making. True/False
-
Developing good character is crucial to consequentialism. True/False
-
Why does the definition of the sport industry affect the calculation of its size? How should the industry be defined?
-
Deontology judges right action based on ones duties. True/False
-
Unqualified audit opinion on erroneous financial statements could result in the audit firm being sued for monetary damages. True/False
-
Dusty is considering three proposals to provide fencing for the 5 acres of grassland that needs to be fenced. Breezy offers an offer of $40 per unit with a 3% defect rate; Lady's offer is $50 per...
-
Explain the differences and similarities between fringe benefits and salary as forms of compensation.
-
Ohio River Company uses a predetermined rate for applying overhead to production using normal costing. The rates for Year 1 follow: variable, 200 percent of direct labor dollars; fixed, 300 percent...
-
Students planning a career in marketing ask why they should learn about accounting. How would you respond?
-
When would the sum of the break-even quantities for each of a companys products not be the break-even point for the company as a whole?
-
Which of Yellows statements regarding the factors affecting the selection of a trading strategy is correct? A. Statement 1 B. Statement 2 C. Statement 3 Robert Harding is a portfolio manager at...
-
To fill the remaining portion of the ABC order, Yellow is using: A. an arrival price trading strategy. B. a TWAP participation strategy. C. a VWAP participation strategy. Robert Harding is a...
-
Given the parameters for the benchmark given by Harding, Yellow should recommend a benchmark that is based on the: A. arrival price. B. time-weighted average price. C. volume-weighted average price....
Study smarter with the SolutionInn App