Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Casino {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner playerInput = new Scanner(System.in);
- Scanner slotMachineInput = new Scanner(System.in);
- Player margerie = new Player("Margerie", 0);
- SlotMachine[] slotMachines = new SlotMachine[3];
- slotMachines[0] = new SlotMachine("Spinning Wheels", 0, 35, 30);
- slotMachines[1] = new SlotMachine("King Tut's Jackpot Tomb", 0, 100, 60);
- slotMachines[2] = new SlotMachine("Fool's Gold", 0, 10, 11);
- System.out.println("How many coins does " + margerie.getName()
- + " have?");
- margerie.setCoins(playerInput.nextInt());
- System.out.println("\nHow many times has " + slotMachines[0].getName()
- + " played since last jackpot? (Maximum of "
- + slotMachines[0].getJackpotSpin() + ")");
- slotMachines[0].setCurrentSpin(slotMachineInput.nextInt());
- System.out.println("\nHow many times has " + slotMachines[1].getName()
- + " played since last jackpot? (Maximum of "
- + slotMachines[1].getJackpotSpin() + ")");
- slotMachines[1].setCurrentSpin(slotMachineInput.nextInt());
- System.out.println("How many times has " + slotMachines[2].getName()
- + " played since last jackpot? (Maximum of "
- + slotMachines[2].getJackpotSpin() + ")");
- slotMachines[2].setCurrentSpin(slotMachineInput.nextInt());
- while (margerie.getCoins() > 0) {
- if (margerie.getCoins() > 0) {
- slotMachines[0].play(margerie);
- }
- if (margerie.getCoins() > 0) {
- slotMachines[1].play(margerie);
- }
- if (margerie.getCoins() > 0) {
- slotMachines[2].play(margerie);
- }
- // System.out.println(margerie);
- }
- System.out.println(margerie.getName() + " played a total of "
- + SlotMachine.getTotalSpins() + " times.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement