Results 1 to 4 of 4
  1. #1
    Denis2k11 is offline Member
    Join Date
    Oct 2012
    Posts
    35
    Rep Power
    0

    Exclamation 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);
           }

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,771
    Rep Power
    5

    Default Re: Help! How to do a leader board table in java?

    Quote Originally Posted by Denis2k11 View Post
    ... Possibly write out the code?? I'd imagine this would be over 150+ lnes :(
    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,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Denis2k11 is offline Member
    Join Date
    Oct 2012
    Posts
    35
    Rep Power
    0

    Default 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

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,771
    Rep Power
    5

    Default 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,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Israel -Raanana SW Team Leader -Java ______EJob 450
    By ziv100 in forum Jobs Offered
    Replies: 0
    Last Post: 04-10-2011, 12:52 PM
  2. SW Team Leader -Java ______EJob 450
    By ziv100 in forum Jobs Discussion
    Replies: 0
    Last Post: 04-10-2011, 12:26 PM
  3. Java Web Developer for Technology Solutions Leader!
    By accolojava in forum Jobs Offered
    Replies: 0
    Last Post: 02-16-2011, 05:41 PM
  4. Senior Java Developer / Team Leader / Consultant
    By devunion in forum Jobs Wanted
    Replies: 1
    Last Post: 10-24-2008, 11:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •