File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Program Review Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Program Review" Watch "Program Review" New topic

Program Review

Canh Ly

Joined: Jun 22, 2012
Posts: 7
Hi guys, I had a question before on a code that I had problem with. Heres my finished project, I only have one small problem still, Ive tested every part and every part compiles and runs up until the last few lines and I cant seem to figure out why. The errors I get are below. The process Im trying to do is use a string to print out the else if statements in my code. I attached my full code below and was wondering if I could get a quick check just to make sure the way Im trying to call my final calculation is correct. It would be much appreciated. This is indeed a homework assignment, but Its already past the due date so I just want to find out the answer for myself thanks!

Canh Ly

Joined: Jun 22, 2012
Posts: 7
Also quick note, in line 111 I just realized It wasn't finished. At the moment it is in a public static double, but should I use a "public static double calculateScore(double assigns, double inclass, double labs, double midterm1, double midterm2, double finalexam){" instead to pass the variables for calculation, or have it a public static double?
Tina Smith
Ranch Hand

Joined: Jul 21, 2011
Posts: 171

You can't define functions inside of other functions/methods. Take a look at line 124; if you want the code to compile you should move the "inner" function you're declaring there to stand as a function by itself.

Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
Greg Ferguson
Ranch Hand

Joined: Jun 04, 2012
Posts: 34
Starting with line 129, it looks like you have redundant code. If you're going to assign a value to grade, you should use it like this:

otherwise the grade variable is not necessary.
I agree. Here's the link:
subject: Program Review
Similar Threads
Averaging Grades Assignment
grade program
Whats wrong with my code
Grade Calculator Alot of Errors While Compiling
trying to make ths work