Results 1 to 3 of 3
Thread: Formatting Issue
- 11-21-2010, 05:29 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 80
- Rep Power
- 0
Formatting Issue
Hi again. I am still working on the While loop, but this is a different problem in the loop.
Many thanks to everyone, pbrockway2, Jos.
I'm getting there and LEARNING(mmmm what a concept).
I've hit a snag. Variable monIntR is displayed as 0.0060. I want it to look like 0.006. So I used the System.out.printf statement and the compiler screamed bloody murder.
Error Message:
The monthly interest is Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '.3f'
at java.util.Formatter.format(Formatter.java:2432)
at java.io.PrintStream.format(PrintStream.java:920)
at java.io.PrintStream.printf(PrintStream.java:821)
at Monthly_Test.main(Monthly_Test.java:24)
I changed the code to add the variable inside the quotes:Java Code:monIntR = (inRateyr / 12)/ 100 ; System.out.printf("The monthly interest is %.3f : " + monIntR);
but the compiler is still unhappy. I Googled the error message and one of the answers was "This means that you didn't specify something to be formatted for the second specifier. "Java Code:System.out.printf("The monthly interest is monIntR = %.3f : " + monIntR);
I went to java2s.com, but I'm still stumped. Do I need some type of pre-defined method???
Thank you
- 11-21-2010, 05:33 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Java Code:System.out.printf("The monthly interest is %.3f ", monIntR);
- 11-21-2010, 10:18 PM #3
Member
- Join Date
- Oct 2010
- Posts
- 80
- Rep Power
- 0
Similar Threads
-
Date formatting
By bikkerss in forum New To JavaReplies: 13Last Post: 05-08-2010, 04:07 PM -
Formatting String
By ersachinjain in forum Advanced JavaReplies: 13Last Post: 10-21-2009, 09:26 PM -
formatting..
By sireesha in forum New To JavaReplies: 16Last Post: 06-26-2009, 07:11 PM -
Formatting a toString
By MooNinja in forum New To JavaReplies: 8Last Post: 03-31-2009, 07:32 PM -
formatting String
By bugger in forum New To JavaReplies: 1Last Post: 11-16-2007, 07:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks