• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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: 2217
47
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: 64179
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!