You're not using printf right. This:
System.out.printf("The circumference of a circle with radius ", radius, " is: ", circumference, ".\n");
should be:
System.out.printf("The circumference of a circle with radius %.2f is: %.2f%n",
radius, circumference);
Where the %f
is a placeholder for your floating point (presumably double here) values.
The whole idea behind printf is to avoid the ugly String concatenation that you're doing in your code. Note that you should use %n
for end of line in printf and similar code, not \n
.
For more details you will want to look at the api for the java.util.Formatter class.