Results 1 to 4 of 4
- 03-19-2013, 07:14 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 24
- Rep Power
- 0
Help! How to do a leader board table in java?
I want to know how to I create a leaderboard in java using 2D arrays or array lists?? I have to read in the name of Games, Scores, Fixtures for vs games, positions etc. Can someone please tell me how to do this?? Possibly write out the code?? I'd imagine this would be over 150+ lnes :(
Java Code:public static void CreateLeaderBoard() throws IOException { String[][] leaderboard = new String [10][10]; String headingsForLeaderBoardOnTopRow = "Position League-Name"; String fileLine; String output = ""; String[] header = headings.split(" "); for(int i=0; i < header.length; i++) { result[0][i] = header[i]; FileReader readafile = new FileReader("GameList.txt"); Scanner readfile = new Scanner(readafile); while(readfile.hasNext()) { fileLine = readFile.nextLine(); for(int j=0; j < 3; j++) { result[j+1][1] = fileLine; } } } for(int j=0; j < header.length; j++) { output += result[0][j] + "\t"; } output += "\n"; JOptionPane.showMessageDialog(null,outcput,"Leaderboard",3); }
- 03-19-2013, 07:29 PM #2
Senior Member
- Join Date
- Jan 2013
- Location
- United States
- Posts
- 636
- Rep Power
- 1
Re: Help! How to do a leader board table in java?
I can assure you that will probably not happen. And if it did it would removed quickly by a moderator. So where are you having problems? What is the format of the output? What does the input look like? Assuming this is for a class, what instructions has the teacher provided?
Regards,
JimThe Java™ Tutorial
YAT -- Yet Another Typo
- 03-19-2013, 07:31 PM #3
Member
- Join Date
- Oct 2012
- Posts
- 24
- Rep Power
- 0
Re: Help! How to do a leader board table in java?
So we take in names, fixtures for a vs battle, scores that are kept. I just need to form a leaderboard but i don't know how
- 03-19-2013, 07:46 PM #4
Senior Member
- Join Date
- Jan 2013
- Location
- United States
- Posts
- 636
- Rep Power
- 1
Re: Help! How to do a leader board table in java?
Ok, I'll focus on the output. Clearly you are going to need to know how format numbers and possibly align numbers and names into columns. What have you tried? have you learned how to format output using either the Format class or the System.out.printf() method? I see you have a two dimensional array of 10 x 10 strings. I could imply 10 rows of 10 columns but I don't know. Have you tried just printing out 10 rows and 10 columns of a string to see how it might be aligned?
I can't read your mind, only guess on what you might need to know. I also saw you put this in a JOptionPane. I recommend you forget about any graphics and focus initially on aligning the output on the console.
Regards,
JimThe Java™ Tutorial
YAT -- Yet Another Typo
Similar Threads
-
Israel -Raanana SW Team Leader -Java ______EJob 450
By ziv100 in forum Jobs OfferedReplies: 0Last Post: 04-10-2011, 12:52 PM -
SW Team Leader -Java ______EJob 450
By ziv100 in forum Jobs DiscussionReplies: 0Last Post: 04-10-2011, 12:26 PM -
Java Web Developer for Technology Solutions Leader!
By accolojava in forum Jobs OfferedReplies: 0Last Post: 02-16-2011, 05:41 PM -
Senior Java Developer / Team Leader / Consultant
By devunion in forum Jobs WantedReplies: 1Last Post: 10-24-2008, 11:14 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks