import java.io.*; import java.text.*; public class RDTest{ //we will read in a double public static void main(String[] args){ System.out.println("Enter a double precision number"); double x; // we shall use x for our number try { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); String s = br.readLine(); DecimalFormat df = new DecimalFormat(); Number n = df.parse(s); x = n.doubleValue(); } // end try catch(IOException e) {x = 0;} catch(ParseException e) {x = 0;} x = x + 2; System.out.println("Your number plus 2 is " + x); } // end main } // end class