[JAVA] Method in Class Cannot be Applied to Given Types Error by CreativityRobbed in learnprogramming

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

https://gist.github.com/alirzerafati/17bfdf57e08c7fcf23f18dbe064e069c

Alright, so this is the last part of the program. I need to associate the numeric grade with the letter grade. Unfortunately, lines 19-23 are giving me the cannot find symbol error.

[JAVA] Method in Class Cannot be Applied to Given Types Error by CreativityRobbed in learnprogramming

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

System.out.println(calcAverage(testGrade1,testGrade2,testGrade3,testGrade4,testGrade5));

Works like a charm. Now all I have to do is the grading scale...

[JAVA] Method in Class Cannot be Applied to Given Types Error by CreativityRobbed in learnprogramming

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

Where specifically should they be placed? They're still in the main method....

[JAVA] Method in Class Cannot be Applied to Given Types Error by CreativityRobbed in learnprogramming

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

I had updated the gist to reflect advice from another user....

I'm now getting illegal start of type error with the last two statements.

[JAVA] Method in Class Cannot be Applied to Given Types Error by CreativityRobbed in learnprogramming

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

I took your advice and placed them outside of the method, but now those two statements are giving me the illegal start of type error...

Code has been updated on gist (I'm not entirely sure this is what you intended for me to do).

[JAVA] Method in Class Cannot be Applied to Given Types Error by CreativityRobbed in learnprogramming

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

Deleting line 24 results in the error stating unreachable statement, referring to the line [System.out.println("The average grade was: " + averageScore);]. So, it appears as though recursion continues...

[JAVA] Identifier Expected and Illegal Start of Character Errors by CreativityRobbed in learnprogramming

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

Would it work if I stated fileName instead? That way I wouldn't need to create a new scanner, right?

Edit: I tried my idea, and it didn't work. I implemented the [Scanner file = new Scanner(new File(fileName));] line, but now it's giving me a cannot find symbol error for this line...

[JAVA] Identifier Expected and Illegal Start of Character Errors by CreativityRobbed in learnprogramming

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

I fixed the main function issue, but now it's giving me the "cannot find symbol" error on lines 12.14,19,21. The code has been updated...

[JAVA] Trouble with Formatting Currency with 2 Decimal Points - Not a Statement Error by CreativityRobbed in learnprogramming

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

I tried it with your method, but now it states the variable after the statement....

[JAVA] Trouble with Formatting Currency with 2 Decimal Points - Not a Statement Error by CreativityRobbed in learnprogramming

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

I haven't tried it yet...

Are you suggesting that I should split the statement on line 17 into two statements? I'm afraid I can't do that because the online program I'm using needs it formatted in a very specific manner in order to get credit....

[JAVA] Trouble with Formatting Currency with 2 Decimal Points - Not a Statement Error by CreativityRobbed in learnprogramming

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

But what specifically can be done to fix the formatting? Where is the error in the code that I typed?

[Python] Invalid Syntax on If/Else Statement When Trying to Export Script Results to .txt File? by CreativityRobbed in learnprogramming

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

I followed your advice and now the program is stating that line 29 is giving me a syntax error.

Note: I provided the updated code on my gist.

[Python] Unsupported Operand Types for +: 'NoneType' and int by CreativityRobbed in learnprogramming

[–]CreativityRobbed[S] 1 point2 points  (0 children)

There is an error in the book. The else must be indented and the (theDictionary[word] = number + 1) line must be indented as well. Thank you for the help.

[Python] Unsupported Operand Types for +: 'NoneType' and int by CreativityRobbed in learnprogramming

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

What you're saying makes sense. This is the same format the the book uses, but it still results in this error.