Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner input = new Scanner(System.in);
- while(true) {
- System.out.println("Price: ");
- try {
- price = input.nextDouble();
- break;
- } catch(InputMismatchException ioe) {
- System.out.println("*** Menu choice must be numeric!");
- }
- if(price <= 0.0) System.out.println("*** Price must be above zero!\n");
- else break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement