A good answer might be:

The answer is seen below:

Complete Program

Here is the complete program. Remember that stdin is this program's name for a BufferedReader object. BufferedReaders buffer characters that come from an InputStreamReader which is connected to the raw input stream System.in.

import java.io.*;
class InputToDouble
{
  public static void main (String[] args) throws IOException 
  {
    String charData;
    double value;

    BufferedReader stdin = new BufferedReader ( new InputStreamReader( System.in ) ); 

    System.out.println("Enter a double:"); 

    charData = stdin.readLine(); 

    value  = Double.parseDouble( charData  ) ;
    System.out.println("value: " + value +" twice value: " + 2*value );
  }
}

There are lots of things to understand in this program. Don't be afraid to go through these notes again.

QUESTION 5:

Just as a review: why must the part throws IOException be used?

Click Here after you have answered the question