Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN1105- Introduction to Programming Part 1: Problem analysis Identify all variables needed by the program Provide a step by step algorithm for the program

image text in transcribed

IN1105- Introduction to Programming Part 1: Problem analysis Identify all variables needed by the program Provide a step by step algorithm for the program There is no Java code required for this part of the assignment Dice Game Specifications: This is a simple betting game where the player tries to predict the outcome of two six-sided dice being rolled. The player starts the game with $100. In each round of the game, the player is asked to place a bet greater than $0 and less than or equal to the amount of money they have, and to predict the number that will be rolled (2-12). Since the odds of predicting correctly are low, the player's bet is multiplied according to the following chart: Dice Roll Predicted 2 or 12 3 or 11 4 or 10 5 or 9 6 or 8 7 Multiplier 50:1 ($10 pays $500) 45:1 ($10 bet pays $450) 40:1 ($10 bet pays $400) 35:1 ($10 bet pays $350) 30:1 ($10 bet pays $300) 25:1 ($10 bet pays $250) At the end of the round, the player is told if they win or lose, and their total money is updated accordingly If they still have money, the player is then asked if they want to play again The game start another round if the player still has money and says 'yes' to playing again The game ends when the player says 'no' to playing again or when they run out of money Sample Execution 1: . You have $100. How much do you bet this round? 200 You have $100. How much do you bet this round? -5 You have $100. How much do you bet this round? 50 You bet $50. What is your prediction for the dice roll? 1 You bet $50. What is your prediction for the dice roll? 15 You bet $50. What is your prediction for the dice roll? 8 Payout is 30:1 Dice 1 comes up 6. Dice 2 comes up 1 Total roll is 7 You lose $50 You now have $50 Do you want to keep playing (y/n)? y You have $50. How much do you bet this round? 50 You bet $50. What is your prediction for the dice roll? 7 Payout is 25:1 Dice 1 comes up 5. Dice 2 comes up 1 Total roll is 6 You lose $50 You now have $0 You are now out of money. Better luck next time! Sample Execution 2: You have $100. How much do you bet this round? 30 You bet $30. What is your prediction for the dice roll? 7 Payout is 25:1 Dice 1 comes up 5. Dice 2 comes up 2 Total roll is 7 You Win $750! You now have $850 Do you want to keep playing (y/n)? y You have $850. How much do you bet this round? 100 You bet $100. What is your prediction for the dice roll? 5 Payout is 35:1 Dice 1 comes up 2. Dice 2 comes up 4 Total roll is 6 You lose $100 You now have $750 Do you want to keep playing (y/n)? n You leave with $750. Hope you play again!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Operations Research

Authors: Frederick S. Hillier, Gerald J. Lieberman

10th edition

978-0072535105, 72535105, 978-1259162985

More Books

Students also viewed these Programming questions