I'm getting an error with the array grade but I've initialized the project and quizzes array already.
here are the instructions:
These methods should return a boolean to indicate success or failure, depending on if the project or quiz number is out of the bounds of the array. The setProjectScore() and setQuizScore() methods will place the double value into the project or quiz number index of its respective array.
I understand that in setProjectScore(), you have to set the value of every element of a to the value of the respective element of projects. This can pose a problem if the projects array is larger than the a array.
So the trick is to first check if projects is larger than a is. If it is, you simply return false. Otherwise, you replace every value of a with the respective value of projects, and then return true.
The arrays have not been declared and initialized. So they don't even know their length!!!
And you are trying to set the value of the 1st value 96 and 88 and whatever.
First declare both the arrays out of the methods. initialize inside the methods and then set the values.
you can't just think of an array write "int a = 96" and expect it to run
Joined: Aug 01, 2012
Campbell Ritchie wrote:Welcome to the Ranch jasonhu hu
thanks,i am very happy in the Ranch
subject: Could someone explain what is wrong with my set methods?