Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Slot Machine
Friday, December 7th, 2007 at 7:21:04am MST 

  1. import java.util.Random;
  2. import java.util.Scanner;
  3. import javax.swing.JFrame;
  4. import javax.swing.JPanel;
  5.  
  6. public class tiger
  7. {
  8.         public static void main(String arg[])
  9.         {
  10.         Random randomnumber = new Random();
  11.         Scanner input = new Scanner(System.in);
  12.         int a = 0;
  13.         int sum=0;
  14.        
  15.         // Start the game
  16.         System.out.println("\n\t\t\tWelocme to play Slot Machine");
  17.         System.out.print("Start");
  18.         String inputing = input.nextLine();
  19.  
  20.                 for (int i = 1; i<=3; i++){
  21.                         for (int j = 1; j<=1; j++){
  22.                         a = randomnumber.nextInt(11);
  23.                        
  24.                         sleep();
  25.                         System.out.printf( "%d\t", a );
  26.                        
  27.                         }
  28.                         sum += Math.pow(10, 3-i) * a;
  29.                 } // end for-loop
  30.                 //sum = 100*a + 10*a + a;
  31.                 System.out.println();
  32.                 System.out.printf("The total amount of thirrd genrated numbers: %d",sum);
  33.         // finish the game
  34.         } // end main method
  35.  
  36.  
  37.   private static void sleep() {
  38.                 try {
  39.       Thread.sleep(3000);
  40.                 } catch (InterruptedException e) {
  41.       e.printStackTrace();
  42.                 }
  43.         }// end sleep
  44.  
  45.         }
  46. //http://hk.geocities.com/newqooland/g3.html?

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.