brainfrz

Untitled

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