// DoubleDiv.java
// Demonstrates floating-point division with type double
// Uses Dorothy Nixon's class ConsoleInput
public class DoubleDiv {
public static void main( String[] args )
{
// read in first number from user as a string
String dividendText =
ConsoleInput.ask(
"Enter dividend (floating-point)" );
// read in second number from user as a string
String divisorText =
ConsoleInput.ask(
"Enter divisor (floating-point)" );
// convert numbers from type String to type double
double dividend = Double.parseDouble( dividendText );
double divisor = Double.parseDouble( divisorText );
// divide the numbers
double quotient = dividend / divisor;
// display the results
System.out.println(dividend + " divided by "
+ divisor + " is " + quotient + ".");
} // method main
} // class DoubleDiv