Advertisement
Homebr3w

slotmachine.java

Feb 13th, 2020
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.41 KB | None | 0 0
  1. public class SlotMachine
  2. {
  3.     private String face1;
  4.     private String face2;
  5.     private String face3;
  6.     private String face4;
  7.     private String face5;
  8.     private String face6;
  9.     private boolean winner;
  10.    
  11.     //contructs a 3 reel, 6 icon slot machine with String descriptions of the 6 visual elements (in the runner class)
  12.     public SlotMachine(String one, String two, String three, String four, String five, String six)
  13.     {
  14.        
  15.     }
  16.    
  17.     //simulates a pull of the slot machine handle by calling faceImage() to randomly generate
  18.     //a resulting face for each of the 3 slot machine reels.  The method returns a String that shows
  19.     //the spin results (e.g., "Spin x:  apple apple grape"). "x" represents the number of times the slot machine has been pulled.
  20.     public String spin()
  21.     {
  22.         int an = faceImage();
  23.         int tn = faceImage();
  24.         int on = faceImage();
  25.     }
  26.    
  27.     public void setWinner(boolean b)
  28.     {
  29.        
  30.     }
  31.    
  32.     public boolean getWinner()
  33.     {
  34.        
  35.     }
  36.    
  37.     //returns a random face from the six icons passed in the constructor and saved in
  38.     //face1 to face6.  Uses 1 + (int)(Math.random() * 6) to generate a random number between
  39.     //1 and 6 that can be used to decide which image to return.
  40.     public String faceImage()
  41.     {
  42.         int x = 1 + (int)(Math.random() * 6);  //returns 1 thru 6
  43.        
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement