Hello, I am new to java and here I have an issue with this code having multiple methods. this is for a grading calculator and ask me how many students, how many grades, and prints the result in an array table...what I want to do is to not just print each mark, but calculate the average and display the average in the array DisplayvalueInArray. my output right now is the student with all the marks for each student.
So you're getting a null pointer exception.
I think I've spotted your problem, but lets see if we can point you in the direction to solve it yourself:
Can you identify from the error message which line of code is causing the problem?
Once you have found that line, take a look at it. What is on that line that might possibly throw a null pointer exception? i.e. what variable/object might be null here?
For the things that might be null, where should they be getting their value from?
well to implement my if statements for taking the array values of homework and taking the average, and then with that average put the value through the loop and assign a letter grade and print it together in the DisplayValueArray. That's what I wanted to accomplish, but there is a brake somewhere and I cant figue it out...I still working on it..and now I am starting another one from scratch. But it would be nice if I could figure that code out lol, but I still have a great deal of learning to do, and I understand.
I'm currently adding another method to calculate the grade average, but to link other methods with the new one is what is killing me. I erased line 55. but like I said earlier everything I add something new the more complex it gets and more errors pop up, and I don't have enough experience to figure all out at this point by myself...did I made it to complex to start with? what is supposed to do is use arrays to save multiple students and multiple grades and calculate and be able to assign a grade letter according to the scale.
Again here I have my newest code, Still have the same problem...the calculateGrade method in line 22I want to get that average and assign it to my GradeLetter method in line 63 and loop it and then the result would be the grade letter which I want to put in the DisplayvalueInArray line 47...but I cant display the grade letter and cant figure it out. below is also my output. thank you guys for your help so far.
I also want to get rid of that null from my result in the scores
Thank you, I mark my methods static because is the only way everything is working so far, but I still have the same issue that I cannot calculate the grade letter and print it out with the grades on the array table
It's never done THAT before. Explain it to me tiny ad:
a bit of art, as a gift, that will fit in a stocking