Results 1 to 10 of 10
Thread: 2 dimensional array help!
- 12-23-2009, 02:54 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
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
- 12-23-2009, 02:58 AM #2
Member
- Join Date
- Sep 2009
- Posts
- 41
- Rep Power
- 0
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?
- 12-23-2009, 03:00 AM #3
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
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
-
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.
- 12-23-2009, 03:41 AM #5
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
thanks, ill see what i can come up with
- 01-01-2010, 11:12 PM #6
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
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
- 01-02-2010, 01:11 AM #7
Member
- Join Date
- Sep 2009
- Posts
- 41
- Rep Power
- 0
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.
- 01-02-2010, 02:14 AM #8
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
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
- 01-02-2010, 04:28 PM #9
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
anyone made anything similar i could see?
- 01-02-2011, 12:29 AM #10
Member
- Join Date
- Jan 2011
- Posts
- 1
- Rep Power
- 0
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
-
assign a value to two dimensional array
By makpandian in forum New To JavaReplies: 4Last Post: 10-05-2011, 05:21 AM -
2 dimensional array with strings.
By dbashby in forum New To JavaReplies: 12Last Post: 10-13-2009, 10:52 PM -
two-dimensional array
By kHim in forum New To JavaReplies: 4Last Post: 11-16-2008, 07:21 PM -
How to initialize a two dimensional Array
By Java Tip in forum java.langReplies: 0Last Post: 04-14-2008, 08:48 PM -
Help with array multi-dimensional
By barney in forum New To JavaReplies: 1Last Post: 07-31-2007, 08:00 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks