Results 1 to 10 of 10
  1. #1
    ber1023 is offline Member
    Join Date
    Dec 2009
    Posts
    10
    Rep Power
    0

    Default 2 dimensional array help!

    i want to make a program where i can enter in wins and loses for NFL teams. lets say the AFC north. i want to be able to enter each times wins and loses and have the program work out the win % and then sort them out in a table by who has the best record. i dont really no where to start. i need some help

    thanks for your time

  2. #2
    Atriamax is offline Member
    Join Date
    Sep 2009
    Posts
    41
    Rep Power
    0

    Default

    A 2 dimensional array could work, but i would say make a Team class, and store all of the info in there, such as the name, wins and losses. For multiple teams, have an array of your Team class. Then, maybe a function could compile stats and get some averages.
    that help at all?

  3. #3
    ber1023 is offline Member
    Join Date
    Dec 2009
    Posts
    10
    Rep Power
    0

    Default

    yea, so have a ravens class, steelers, etc with there own 2 dimensional array.

    the most puzzling thing to me right now is how to sort them using the win pct. im totaly stuck

    thanks

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by ber1023 View Post
    yea, so have a ravens class, steelers, etc with there own 2 dimensional array.
    No. Have a single Team class, and give it a String name field. Then you can have a Team object with a name property of Ravens, another object with a name property of Steelers, etc...

    You could have a Game class that holds two Team objects and stores their scores, and then perhaps a Season class that holds an ArrayList of Games. Each Team could also have an ArrayList of its own Games. The possibilities here are endless.

  5. #5
    ber1023 is offline Member
    Join Date
    Dec 2009
    Posts
    10
    Rep Power
    0

    Default

    thanks, ill see what i can come up with

  6. #6
    ber1023 is offline Member
    Join Date
    Dec 2009
    Posts
    10
    Rep Power
    0

    Default

    im still stuck getting started even with just making the tabel with it labeled as ravens, steelers, etc and entering in there wins and losses

  7. #7
    Atriamax is offline Member
    Join Date
    Sep 2009
    Posts
    41
    Rep Power
    0

    Default

    Are you trying to just make a table using text or are you trying to use a JTable?
    Last edited by Atriamax; 01-02-2010 at 01:14 AM.

  8. #8
    ber1023 is offline Member
    Join Date
    Dec 2009
    Posts
    10
    Rep Power
    0

    Default

    just a table , iv never heard of JTable.

    i just want to enter in the wins and losses for each team and then get the win pct and sort it in order

  9. #9
    ber1023 is offline Member
    Join Date
    Dec 2009
    Posts
    10
    Rep Power
    0

    Default

    anyone made anything similar i could see?

  10. #10
    mihir_kmt is offline Member
    Join Date
    Jan 2011
    Posts
    1
    Rep Power
    0

    Default Sorting 2-dimensional integer array

    I have this 2 - dimensional integer array and would like to sort it on the basis of 2 nd column in asscending order.

    int [][] 2d = { { 1, 13, 4 },
    { 2, 4, 7 },
    { 8, 3, 10},
    { 5, 0, 13},
    { 9, 8, 17} };


    I tried using comparator but i suppose it is only for strings and I will have to convert the integer array to string which becomes tedious if the array size is large. All suggestions are welcomed . Thanks a ton

Similar Threads

  1. assign a value to two dimensional array
    By makpandian in forum New To Java
    Replies: 4
    Last Post: 10-05-2011, 05:21 AM
  2. 2 dimensional array with strings.
    By dbashby in forum New To Java
    Replies: 12
    Last Post: 10-13-2009, 10:52 PM
  3. two-dimensional array
    By kHim in forum New To Java
    Replies: 4
    Last Post: 11-16-2008, 07:21 PM
  4. How to initialize a two dimensional Array
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-14-2008, 08:48 PM
  5. Help with array multi-dimensional
    By barney in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 08:00 PM

Posting Permissions

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