Results 1 to 6 of 6
Thread: Basic high score program
- 09-03-2009, 03:43 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 50
- Rep Power
- 0
Basic high score program
I would like to know the best way write a program that prompts the user to enter the students names and grades. then it outputs the students name and the highest grade.
I know the Math.max() only takes 2 args, is there not an easier way for an unknown amount of variables.
Please help with this program.
thanks
- 09-03-2009, 04:04 PM #2
It depends how you store the input in your program. Have a look at Arrays.sort(); Collections.sort(); Comparator and Comparable
- 09-03-2009, 04:08 PM #3
Member
- Join Date
- Aug 2009
- Posts
- 50
- Rep Power
- 0
Thanks alot for the quick response.
- 09-03-2009, 04:49 PM #4
Member
- Join Date
- Aug 2009
- Posts
- 25
- Rep Power
- 0
An array should do the trick for you as phHein pointed out.
An hashset is perhaps even better because then you'll have a reference to the names aswel.
- 09-03-2009, 05:08 PM #5
Member
- Join Date
- Aug 2009
- Posts
- 50
- Rep Power
- 0
havent got that far yet, actually the exercise which I had the question for wasnt even using arrays yet, it wasnt storing data, but, yeah I dont get why there some examples in books, and then as you learn more those older techniques become obsolete?
Also , in the book I am using in my first year at university is the Daniel Liang, introduction to java comprehensive 7/E. and in the beginning there are examples to print out tables and triangles etc. is that even necessary, I thought there were more advanced software to do much better graphics.There are loops, nested for loops etc, to print out tables next to each other, the only reason I can think is that it is to teach us how to use loops properly, because surely it cant be so timewasting to write out loads of loops for printing in certain styles?
- 09-03-2009, 05:21 PM #6
Member
- Join Date
- Aug 2009
- Posts
- 76
- Rep Power
- 0
Similar Threads
-
show a high score from tetris
By stessie in forum Java AppletsReplies: 0Last Post: 03-19-2008, 03:00 AM -
Basic Program Please Help!!
By VinceGuad in forum New To JavaReplies: 3Last Post: 02-01-2008, 03:35 PM -
Need help with a program for high school regarding multi-dimensional arrays.
By Torque in forum New To JavaReplies: 2Last Post: 01-07-2008, 07:45 PM -
get the average and maximum score
By Eric in forum Advanced JavaReplies: 2Last Post: 07-01-2007, 04:15 AM -
Klaverjas Score 0.2
By levent in forum Java SoftwareReplies: 0Last Post: 05-23-2007, 07:40 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks