Hey, i'm super stuck on my lab in cs102. I have attempted it but never got close to what the end result should be. Please help, due in 2 days!!
Assignment
You will be writing a program to simulate a slot machine. The player will start with $1000 and you will repeatedly ask the user how much money they wish to insert into the machine before spinning, or allow the player to quit. If the player runs out of money, the game is over. Additionally, the player cannot spend more money than they have available. You should store the player's wagers and winnings in order to output statistics when the user is done playing.
Spinning and Payouts
After placing a bet, the money is immediately subtracted from the player's balance. The slot machine has 3 reels which are spun after the lever is pulled. Each reel will randomly contain a integer value between 2 and 7 inclusive after being spun. If the all 3 reels have the value 7, the player obtained a jackpot and will receive the amount which they wagered times 10. If all 3 reels match, but contain a value other than 7, award the player their wagered amount times 5. Otherwise, if only 2 reels match, award the player their wager times 2. If none of the reels match, the player does not receive any earnings.
Restrictions / Hints
1. At the start, ask the user for a seed to use for the random number generator. Use this value to seed your random numbers.
2. Before each spin, show the user their current balance and ask for a wager.
3. The slot machine only accepts wagers containing whole dollar amounts. You may not enter any spare change.
4. You must use an array to store the value of each reel.
5. You must use a for loop to input the random values of each reel.
6. You must use a vector to store the amount of each wager.
7. You must use a vector to store the winnings of each spin.
8. If the user wagers an amount of 0 or less, stop playing and output play statistics. Additionally, if the user has a balance of $0 and is unable to wager, end the game and output play statistics. If the user never played and walks away immediately, do not output any statistics.
9. At the end, output a summary of each spin including the wager and amount won. Then output the smallest and largest wager, and the smallest non-zero winnings and the largest winnings from a single spin. Note that if the user never wins, the smallest and largest winnings displayed should be 0.
I know its alot of stuff and restrictions but I'd really appreicate it if someone can write a correct code so I can figure out where i went wrong. TYY
import acm.program.*;
import acm.util.*;
/*
* THIS PROGRAM SIMULATES THE SLOT MACHINE
*/
public class cap6ex5 extends ConsoleProgram{
private RandomGenerator rgen = RandomGenerator.getInstance();
private int money = 50; //starting stake
private String value = "";
public void run(){
String instAnswer = readLine("Would you like instructions?");
while (!instAnswer.equals("yes") &&
!instAnswer.equals("no")) {
instAnswer = readLine("Answer yes or no.");
}
if (instAnswer.equals("yes")) println("YOU SHOUD KNOW!");
startGame(money);
}
private void startGame(int x){
String keepPlaying = "";
int finalMoney = x;
int prize = 0;
while (finalMoney > 0){
keepPlaying = readLine("You have $" + finalMoney +". Would you like
to play?");
//avoid different answers
while(true){
if (keepPlaying.equals("yes") || keepPlaying.equals("no"))
break;
keepPlaying = readLine("Asnwer yes or no.");
}
if (keepPlaying.equals("no")) break;
finalMoney--;
prize = gamePrize();
finalMoney += prize;
println(value + " -- You win $" + prize);
}
println("Okay, bye. You ended with $" + finalMoney);
}
private int gamePrize(){
int countBAR = 0; //BAR == 1
int countBELL = 0; //BELL == 2
int countPLUM = 0; //PLUM == 3
int countORANGE = 0;//ORANGE == 4
int countCHERRY = 0;//CHERRY == 5
value = "";
for (int i = 1; i <= 3 ; i++){
int x = rgen.nextInt(1, 6);
switch(x){
case 1:
countBAR++;
value += "BAR ";
break;
case 2:
countBELL++;
value += "BELL ";
break;
case 3:
countPLUM++;
value += "PLUM ";
break;
case 4:
countORANGE++;
value += "ORANGE ";
break;
case 5:
countCHERRY++;
value += "CHERRY ";
break;
case 6: value += "LEMON "; break;
}
}
return result(countBAR, countBELL, countPLUM, countORANGE, countCHERRY);
}
private int result(int bar, int bell, int plum, int orange, int
cherry){
int prize = 0;
if (bar == 3){
prize = 250;
} else if ((bell > 1 && bar ==1) || bell == 3){
prize = 20;
} else if ((plum > 1 && bar == 1) || plum == 3){
prize = 14;
} else if ((orange >1 && bar == 1) || orange ==
3){
prize = 10;
} else switch(cherry){
case 1: prize = 7; break;
case 2: prize = 5; break;
case 3: prize = 2; break;
}
return prize;
}
}
OUTPUT

Hey, i'm super stuck on my lab in cs102. I have attempted it but never got...
Please i need helpe with this JAVA code. Write a Java program simulates the dice game called GAMECrap. For this project, assume that the game is being played between two players, and that the rules are as follows: Problem Statement One of the players goes first. That player announces the size of the bet, and rolls the dice. If the player rolls a 7 or 11, it is called a natural. The player who rolled the dice wins. 2, 3...
This needs to be done using c++ No vectors or arrays can be used since we haven't learned them yet! Write a program that simulates a slot machine. The slot machine should have the following characteristics: - 3 view windows to display items on a wheel. Typically, these are cherries, bars, etc. - each wheel will randomly select a number 1-7. - the user will be charged 5 tokens to spin the wheels Winning combinations will be as follows: -...
Just do program 6 using c++ which are printf and scanf. Please
don’t use cout and cin.
Program 4: A slot machine has three windows. A random fruit is picked for each window from cherry apple, lemon, and orange. If all three windows match, the user wins 8 times the bet amount. If the first two windows only are cherries, the user wins 3 times the bet amount. If the first window is a cherry and the second window is...
You will write a two-class Java program that implements the Game of 21. This is a fairly simple game where a player plays against a “dealer”. The player will receive two and optionally three numbers. Each number is randomly generated in the range 1 to 11 inclusive (in notation: [1,11]). The player’s score is the sum of these numbers. The dealer will receive two random numbers, also in [1,11]. The player wins if its score is greater than the dealer’s...
Write a Python program that simulates a wheel of fortune game. The game is played as follows: Spin a wheel with a group of numbers (0-10). If you got a 1, 2 or a 3, the game is over. If you got a 4, 5, or 6, you win that many dollars ($4, $5, or $6), and then spin again, or if you got 7, 8, 9, or 10, then you win $14,$16,$18, or $20 and then spin again. If...
Problem Statement: A company intends to offer various versions of roulette game and it wants you to develop a customized object-oriented software solution. This company plans to offer one version 100A now (similar to the simple version in project 2 so refer to it for basic requirements, but it allows multiple players and multiple games) and it is planning to add several more versions in the future. Each game has a minimum and maximum bet and it shall be able...
HEy GUYS PLZ I WROTE THIS CODE BUT I WAS ASKED TO ADD SOME
ASSERTION TESTS AND I HAVE NEVER DONE SUCH THING. CAN YOU GUYS
HELPS ME OUT ON HOW TO TEST A SIMPLE CODE SINCE ITS A GUESSING
GAME! THANK YOU. PYTHON
import random # here it allows us to use the benefits of the functions random #function 1 which is just a screen organized wordings def screen): screeninstructions () name input("Your Name : ") print('Welcome, name, 'This...
I'm having trouble understanding pointers in my c programming class. I posted the pointer assignment below. If you could leave comments pointing out where pointers are used it would be much appreciated! ----------------------------------------------------------------------------------------------------------------------------------- Write a complete C program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of 10 dollars) and the machine dispenses this amount using the least number of bills. The bills dispenses are 50s, 20s, and 10s. Write a...
In java language
here is my code so far! i only need help with the extra credit
part
For this project, you will create a Rock, Paper, Scissors
game.
Write a GUI program that allows a user to play Rock, Paper,
Scissors against the computer.
If you’re not familiar with Rock, Paper, Scissors, check out the
Wikipedia page:
http://en.wikipedia.org/wiki/Rock-paper-scissors
This is how the program works:
The user clicks a button to make their move (rock, paper, or
scissors).
The program...
This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named Budgeter.java. To use a Scanner for console input, you must import java.util.*; in your code. This program prompts a person for income and expense amounts, then calculates their net monthly income. Below are two example logs of execution from the program. This program’s behavior is dependent on the user input (user input is bold and underlined below to make it stand out and differentiate...