This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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: 2203
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: 62144
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
We don't have time to be charming! Quick, read this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!