printf is a method of the PrintWriter class. Your first step should be to look at the API documentation:
Java 6 - Print Writer API Documentation. There are two signatures to consider:
1) printf(String format, Object... args)
2) printf(Locale l, String format, Object... args)
If you don't care about the locale then you just need to use the first one.
There are different formats that can be specified in the first string, but the one you are concerned with is "%f". That says - Hey, format this as a float. Taking it a step farther, I suspect you are interested in limiting the precision. You can do this by doing something like "%.2f" This will set the precision to 2 digits. Here is a revised working example:
[edit]Add code tags. CR[/edit]
[ October 10, 2008: Message edited by: Campbell Ritchie ]