Okay. Back to basics.
Note that you have two while loops to read data from the file. The first while loop reads everything the file has to offer. The second while loop has nothing left to read and is skipped. You don't need two while loops. If you combine the two while loops into the first, you'll be fine.
Another problem, while the while loop is collecting the data from the file, i remains constant. The data collected from the file is all stored in array index 0, each on top (replacing) the previous.
Line 27, where you intended to sum the grades, is misplaced (too early) and then useless because of the problem above.
Fix those things, and there will be more. Try to fix any other problems that you can, but come back when you need more help, posting your updated code.
15 Replies - 339 Views - Last Post: 04 February 2012 - 02:41 PM
Topic Sponsor:
#16
Re: Exception in thread "main" java.util.NoSuchElementException
Posted 04 February 2012 - 02:41 PM
|
|

New Topic/Question
Reply




MultiQuote


|