Your getProjectScoreForID method always returns empty string.
projects array is filled so that all the values are -1 (in your constructor), and in main method you didn't put any other values in it. If you check the the getProjectScoreForID method you'll see that -1 doesn't satisfy any of those if-else if conditions you have there. That's why you get no output. If you replace the last else if with just else (e.g. all scores less than 50 are graded with F, no matter if it's 0 or 49 or other value), it should probably work.
You have the same situation in your getQuizScoreForID method.
By the way, didn't you already post something similar to this? I think I've seen this class yesterday...
The quieter you are, the more you are able to hear.
kenny gill wrote:I'm not sure where the problem is in the code so I'd really appreciate it if someone could look over my code and see what's wrong.
Well first, could you please correct the indenting. As it stands it makes your code very hard to read.
However, a few things off the top of my head; none of which have anything to do with your problem:
1. You do like 'while' loops, don't you? Why not just use 'for' loops? They're generally much more compact and complete. And for the ones in your Student constructor, you could use Arrays.fill().
You might also want to think about providing a descriptive constant for your "doesn't have a score" value, eg:
public static final double NO_SCORE = -1.0;
2. The code at 111-125 is repeated verbatim at line 137.
3. Your checks at lines 87 and 98 basically do exactly the same thing, just with different arrays. How do you think you might make them more generic?
It's also worth noting that another alternative is not to do them at all and just let the method throw an ArrayIndexOutOfBoundsException. It's sometimes best not to mollycoddle your users too much.
5. You don't have to use 'array.length - 1' all the time. Have a think how you could modify your conditions to just use 'array.length'.
6. getProjectScoreForID(int ID) seems very low level for a public method. How is a client likely to know that Josh Bloch's Biology project is @ ID number 7?
7. getProjectsLength() and getQuizzesLength() are poor choices for method names, since they describe internal details (the length of the array) that a client really doesn't need to know about. How about projectsCompleted() and quizzesTaken()?
8. Again, getNextProjectsIndex() seems very "bits and bytes". Why not just have an addProjectScore() method, and hide all that index manipulation away from your clients?
Indeed, if those arrays were Lists instead, you could just use its add() method, and you wouldn't have to worry about any limits.
When you've corrected the indenting I'll have a look at your actual problem.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here