*******************************************************
Three methods that might throw an exception
Class Method Throws
Scanner nextDouble() InputMismatchException
Integer parseInt(String) NumberFormatException
Double parseDouble(String) NumberFormatException
*******************************************************
Two ways to import the InputMismatchException class
import java.util.InputMismatchException;
import.java.util.*;
*******************************************************
double subtotal = 0.0;
try
{
System.out.print("Enter subtotal: ");
subtotal = sc.nextDouble();
}
catch(InputMismatchException e)
{
sc.next(); // discard the incorrectly entered double
System.out.println("Error! Invalid number. Try again.\n");
continue; // jump to the top of the loop
}