Problem with System.out.printf command in Java

%d represents an integer; you want to use %f for a double. See the formatting string syntax in the Javadoc