Would

final String charData = "0.314159265E+1";

work?

A good answer might be:

Sure. Scientific notation works as input.


Keyboard Input

Scientific notation is a way of using characters to express a number. When it is converted to a double you get the same double that you would get with ordinary notation. "0.314159265E+1" converts to the same double that "3.14159265" converts to. The resulting 64-bit pattern is the same in both cases. Here is the program again. Now the keyboard is used for input.

import java.io.*;
class InputToDouble
{
  public static void main (String[] args) ___________________________

  {
    String charData;
    double value;

    __________________________________

    __________________________________

    __________________________________

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

Unfortunately, the program is not complete. These are the missing parts, but not in order:

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

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

charData = stdin.readLine();

throws IOException

QUESTION 4:

Match the lines to the blanks in the program.