• Post Reply Bookmark Topic Watch Topic
  • New Topic

problems with return method involving arrays  RSS feed

 
Mulk Abdulhadi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The output is :

The numbers in the array are: 1 2 3 4 6 7 8 9 10 13 14 15
The highest grade is: 11




I have no idea what is wrong with the code. Please Help
For some reason it is not giving me the highest number in my array. Did I write the method wrong ? Is my array even passing through HighestGrade ?
 
Carey Brown
Saloon Keeper
Posts: 3310
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you intended on doing but you are printing the index into the array and not the value at that index.
 
Mulk Abdulhadi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:Not sure what you intended on doing but you are printing the index into the array and not the value at that index.



I am just trying to print out the highest grade which would be 15 .
 
Carey Brown
Saloon Keeper
Posts: 3310
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mulk Abdulhadi wrote:
Carey Brown wrote:Not sure what you intended on doing but you are printing the index into the array and not the value at that index.



I am just trying to print out the highest grade which would be 15 .

Yes, and you're printing out the index into the array at which '15' resides.
 
Mulk Abdulhadi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So , how do I make it print out 15 ?
 
Carey Brown
Saloon Keeper
Posts: 3310
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In this method you already have an example of how to get a grade from the max index (hint: line 6).
 
Mulk Abdulhadi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WOW , okay I got it . Thanks for your help .

I just changed:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!