• Post Reply Bookmark Topic Watch Topic
  • New Topic

ArrayLists  RSS feed

 
Elaine Giblin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm new to Java and hope you can help me, I'm writing code for a student registration system that calculates average assignment total, average exam mark and overall mark and am having problems. The first is that after the last for loop where I enter assignment mark details, the list prints out each time after the assignment and I my average functions are not working properly either. Any guidance on where I'm going wrong would be much appreciated. Code below.

 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what is the problem?
What I can say that your code is way too long .Everything is crammed. And there are eight (!!!) closing brackets at the end.

So, try to split this into smaller parts. Don't write one part until you can be 100% sure that previous one works correctly.

You have everything in one main method. Calculations, iterations, getting user input... It's not good idea.
I don't think having a switch statement inside 4 nested loops in one main method is what you want.

Please, read this: MainIsAPain

Also: ItDoesntWorkIsUseless
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!