Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
top 10 high score program Posted by wacka on 13 Mar 2013 at 6:16 AM
I am 6 weeks into a java programming class and we have just been given our first major program to write.

I need to be able to create a java program that keeps track of the top 10 scores. Basically, the program will ask you for a name and then a score and then store it in an array. You will be able to enter 10 names and 10 scores and the program will insert the name and score in the appropriate place in the table. If two people have the same score, it will keep the first person to score that amount above the second person to score the same.

The only guidance I've got from the tutor is to create it all in a loop (you exit the program by typing in "quit" instead of a name. I was told that I will need an array to store the names and the scores and the program needs to start at position 10 and move up the table to find out the insertion point of where the new score should be placed. Once the insertion point in the table has been found, the program will shuffle all the other scores down one place, insert the new score and then go back to asking for a new name and score.

I was told that this program can all be made within one class,using a keyboard input utility (import java.util.Scanner), and using only for, while, do-while loops, IF statements, compareto and .length for string handling.

Does anybody have any idea how to go about it? All I can really do at the moment is have the program ask for a name and a number and store it.

What do I need to be even looking at? Our guidance is very vague with no code examples at all on how to do anything other than create loops and setup an array. We have covered nothing about how to move values down the array. Obviously if you just moved a value out of a part of the array and placed it somewhere else in the array it would overwrite the value that is already there, not move it down and just delete the last one.

The books I have read through tell you how to sort an array into ascending or descending order but not shuffle it all down one place.
They also make use of importing a java utility to do it, the array.sort. The tutor specifically said the only utility we will need to import is the Scanner one.

Any pointers, code snippets or anything would be appreciated.
Thanks.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.