fauzie811

BlueJack

Apr 5th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class BlueJack {
  4.  
  5.   public static void main(String[] args) {
  6.    
  7.     boolean success = false;
  8.     int min = 100000;
  9.     int max = 3000000;
  10.     int money;
  11.  
  12.     Scanner in = new Scanner(System.in);
  13.  
  14.     System.out.println("BlueJack Money Storage");
  15.     System.out.println("======================\n");
  16.  
  17.     do {
  18.  
  19.       System.out.printf("Input the amount of money you have [%d..%d] : ", min, max);
  20.  
  21.       if (in.hasNextInt()) {
  22.      
  23.         money = in.nextInt();
  24.        
  25.         if (money >= min && money <= max) {
  26.        
  27.           success = true;
  28.          
  29.         } else {
  30.        
  31.           System.out.printf("Amount of money which inputed is between %d and %d\n\n", min, max);
  32.           in.nextLine();
  33.          
  34.         }
  35.        
  36.       } else {
  37.      
  38.         System.out.println("Input is only number\n");
  39.         in.nextLine();
  40.      
  41.       }
  42.  
  43.     } while (!success);
  44.  
  45.   }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment