First of all, %s means string, and %f means float number.
System.out.printf("%-40s %-6.2f", "Borrowing Fee: $", borrowingFee + "\n");
In your case, the 3rd argument, borrowingFee + "\n", creates a string, which couldn't match up with %f. Which is why you might get the exception message java.util.IllegalFormatConversionException: f != java.lang.String
Here the IllegalFormatConversionException indicates that f(%f) is incompatible with java.lang.String.
The simple fix is moving the \n into the 1st argument, since it's the format:
System.out.printf("%-40s %-6.2f\n", "Borrowing Fee: ", borrowingFee);
Notice that the first argument "%-40s %-6.2f\n" is the format that creates blanks with %s and %f, and the rest arguments are the fillings for those blanks.
In addition, your 2nd argument, "Borrowing Fee: $", is promised to be a fixed string. Unless you want a giant space between the colon and the number like Borrowing Fee: 55.00, you don't need to format it. You can simply do
System.out.printf("Borrowing Fee: %.2f\n", borrowingFee);
or slightly larger space with \t
System.out.printf("Borrowing Fee:\t %.2f\n", borrowingFee);
printf on docs.oracle.com (java7):
public PrintStream printf(String format,
Object... args)
Parameters:
format - A format string as described in Format string syntax
args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by The Java™ Virtual Machine Specification. The behaviour on a null argument depends on the conversion.
I intend to explain the function call and the error in your code.
Check Andy's link for details on formatting.