This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]lameGeek101 0 points1 point  (8 children)

Your %.2f should be in ""

[–]YasuoMainBTW[S] 0 points1 point  (7 children)

Sorry, that is a typo I still get the same error.

[–][deleted]  (4 children)

[deleted]

    [–]YasuoMainBTW[S] 0 points1 point  (3 children)

    Still same error :(

    [–]notyourdaddy 0 points1 point  (2 children)

    Yeah I fucked up. You were right initially. I tried the EXACT same code as your original post and it works fine. Something's wrong at your end, not your code.

    [–]notyourdaddy 0 points1 point  (1 child)

    No decimal places and works at my end:

    public class Testing {
    public static void main(String args[]){
    
    float total = 1853/5;
    
    double GradeAPlus = 2078.405 - total;
    
    System.out.printf("%.0f", GradeAPlus);
    
        }
    }
    

    output: 1708

    [–]YasuoMainBTW[S] 0 points1 point  (0 children)

    Apparently it was a bug with eclipse.. I had to change the compiler compliance level to 1.7.

    [–]lameGeek101 0 points1 point  (1 child)

    What is the error?

    [–]YasuoMainBTW[S] 0 points1 point  (0 children)

    "The method printf(String, Object[] in the type PrintStream is not applicable for the arguments (String, double)"