• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

ArrayLists  RSS feed

 
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.

 
Bartender
Posts: 2180
46
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
 
Marshal
Posts: 60163
188
  • 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!