Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class TextBooks {
- public static void main(String[] args) {
- userInteraction();
- }
- public static void userInteraction(){
- q3();
- }
- public static void q3(){ //book cost
- Scanner userInput = new Scanner(System.in);
- double value =0;
- boolean test = false;
- int qNum = 3;
- while(true){
- System.out.println("What is the cost of the book?");
- try{
- value = Double.parseDouble(userInput.next());
- System.out.print(value);
- break;
- }catch (NumberFormatException e){
- System.out.println("Invalid input");
- }
- }
- //numValidation(qNum,valueTest);
- }}
- public static double numValidation(double x, String y){
- return numValue;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement