brainfrz

Untitled

Oct 10th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package sandbox.prompts;
  2.  
  3. import sandbox.prompts.PromptInRange;
  4. import java.util.Scanner;
  5.  
  6. public class PromptTest
  7. {
  8.     public static void displayInput( int i )
  9.     {
  10.         System.out.println("You typed " + i + ".");
  11.     }
  12.    
  13.    
  14.    
  15.     public static void main( String[] args )
  16.     {
  17.         Scanner user_input = new Scanner(System.in);
  18.         int i;
  19.  
  20.         i = PromptInRange.promptWholeNumber();
  21.         displayInput(i);
  22.        
  23.         i = PromptInRange.promptIntInRange(5, 10);
  24.         displayInput(i);
  25.        
  26.         i = PromptInRange.promptIntInRange(5, 10, "Read the prompt, doofus!");
  27.         displayInput(i);
  28.        
  29.         i = PromptInRange.promptIntInRange(5, 10, "Less than minimum.", "Greater than max.");
  30.         displayInput(i);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment