Starting from:

$35

JAVA- Project 1: One Armed Bandit Solved

Program Description: 

For this project you will be creating a simulation of a slot machine. Slot machines in the form that we typically see in casinos and other gambling establishments, or almost every establishment in certain cities in the U.S., trace their roots back to the late 1890’s in San Francisco. The “Liberty Bell”, created by Charles Fey, contained three spinning reels decorated with five different symbols: bells, spades, hearts, horseshoes, and diamonds. A player would insert a nickel into the slot, hence the term slot machine, and could win a whopping 50 cents as the biggest payouti. The machines have progressed considerably since then and can now be found themed as many of your favorite movies, books, historical time periods, professions and the maximum payouts can be in the tens of millions of dollars.

While your simulation will not be bringing in any taxable revenue to the state, constructing many of the aspects of a slot machine should provide a complex task. Your slot machine will need to be an engaging and interactive experience for the player, just without the lights and sirens. It will need to manage the player’s winnings, allow them to add additional funds and of course play the game. It is also recommended that you take some time to design your program before you begin coding to improve its overall flow and organization.

Program Requirements
The player should start with 100.00 dollars
The machine should start with a balance of 0.00 dollars
The default bet should be 1.00 dollar
The machine should have an array of seven words, of your choice, that could be selected for each of the three reels
The set of three reels should be stored as a single, 3X3, 2-dimensional array
Your program should print out a welcome message, explain how to win the game (see below), and inform the user of the current bet amount
The following are possible winning combinations o Three of a kind on any single row, column, or diagonal (Payout is 3X the bet amount) o Two of a kind adjacent to each other on any single row, column, or diagonal (Payout is 2X the bet amount)
▪ i.e. If the row/column/diagonal had A-A-A, it must be counted as a three of a kind and not two, two of a kinds

o If multiple instances of three of a kind or two of a kind exist, the payouts should be summed

Your program will need a menu, implemented as a switch, in which you provide the following options and prompt the player for which action they wish to perform with an appropriate message:Add money to the machine o Change their bet amount o Play the game o Leave the machine and pay out all of their winnings
Each of the four options must be implemented as its own method, which should be called via the appropriate case in the switch o Each method should have an appropriate name, return type, list of parameters, and comment block (multi-line comments or Javadoc comments)
Your program will need to allow the player to make choices and play the game until they wish to leave o The program should inform the player of how much money they have, the machine’s balance, the current bet amount, redisplay the main menu and prompt for a choice at the beginning of the game and after every main menu choice If the player chooses to add money to the machine:Prompt the player for how much they wish to add o Determine if that amount is less than or equal to the amount the player current hasIf that amount is, then add the amount to the machine and deduct it from the player
If it is not, then inform the player they do not have that much money o Display how much money the player has, and the current balance of the slot machine, with an appropriate message
If the player chooses to change their bet amount:Prompt the player for how much they would like to bet for future games (this number must be greater than 0) with an appropriate messageIf the player’s bet amount is greater than 0, inform the player that all future bets will be of this value until they change it again
If the player’s bet amount if 0 or less, inform them of the mistake and that the bet amount remains unchanged
If the player chooses to play the game:First, determine if the machine has enough money in its balance to cover the current bet amountIf it does, inform the player that the game is about to start
If it does not, inform the player they do not have enough money to pay for the current bet amount
Deduct the current bet amount from the slot machine’s current balance o Using a random number generator, choose one of the words from your array of seven to apply to each of the nine positions on the reels. Note that the same word could be chosen multiple times. These words should be displayed to the player in a pleasing grid format (i.e. all columns must be the same width without excessive white space), similar to a real slot machine.
If the player has at least one winning combination, as described aboveUsing an appropriate message, inform the player of each way they won, and the total payout
Credit the slot machine’s current balance the total payout o If the player has no winning combination, as described above
Using an appropriate message, inform the player that they lost this round but to try again
If the player chooses to leave the machine and pay out all of their winnings:
o Using an appropriate message, inform the player:

How much they won or lost (i.e. their winnings minus the losses and the money they personally added to the machine)
That they will be paid the current balance of the slot machine and display that balance o Exit the game
If the player inputs an option that is not on the menu, then inform them of their mistake with an appropriate message, redisplay the menu options, and ask for a new choice
No global variables are allowed for this project
Your code should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, date, and brief description), comments for each variable, and commented blocks of code
Your program source code should be named java
                 

Project Timing
An important aspect of project development is planning out the work, dividing the work into portions, and then estimating how long each piece will take. This strategy is quite common when using popular development strategies such as SCRUM or Extreme Programing. However, generating adequately sized portions and then estimating how long that portion will take to complete is a skill. Therefore, we will be using the projects in this course to help you develop this skill!

To make things a bit easier for this project, the work has already been divided into the following portions:

Initial program setup (common variables, array of seven words, 3x3 array)
Designing and implementing the menu and requisite control structures
Designing and implemented the adding money functionality
Designing and implemented the changing bet amount functionality
Designing and implemented the playing the game functionality
Designing and implemented the cashing out functionality
Before you start any coding, for each portion you will need to estimate how long you think implementing that functionality will take, round up to 30 minute increments, and note that down. A clever industry strategy is that once you estimate your time, you should double it. Then while you are implementing a portion, keep track of how long it takes you to successfully develop that functionality, round up to 30 minute increments, and note the amount of time down at the end. Additionally, if your actual time was under or over your estimate, briefly speculate on why that is the case. When you submit your project, you will also need to submit a PDF file containing your timing information and speculations. S

More products