Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import java.util.*;
  2. public class TextBooks {
  3.  
  4.     public static void main(String[] args) {
  5.         userInteraction();
  6.  
  7.     }
  8.     public static void userInteraction(){
  9.         q3();
  10.     }
  11.  
  12.  
  13.     public static void q3(){   //book cost
  14.         Scanner userInput = new Scanner(System.in);
  15.         double value =0;
  16.         boolean test = false;
  17.         int qNum = 3;
  18.        
  19.        
  20.         while(true){
  21.         System.out.println("What is the cost of the book?");
  22.         try{
  23.             value = Double.parseDouble(userInput.next());
  24.             System.out.print(value);
  25.             break;
  26.         }catch (NumberFormatException e){
  27.             System.out.println("Invalid input");
  28.         }
  29.        
  30.     }
  31.         //numValidation(qNum,valueTest);           
  32.     }}
  33.  
  34.  
  35.         public static double numValidation(double x, String y){
  36.    
  37.             return numValue;
  38.    
  39.    
  40.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement