This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes which of these 2 arrays is right Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "which of these 2 arrays is right" Watch "which of these 2 arrays is right" New topic
Author

which of these 2 arrays is right

Lindsey Ship
Greenhorn

Joined: Feb 07, 2003
Posts: 19
Hi to every one, sorry I keep coming back but you seem like a good bunch out their.I need to do a 3imensional array.But I am new to programming, with no cow hands here to help me.
As you will see its a array of airports ect but each airport could have upto 5 flights a day. So i need to take that into consideration.From the array if i enter a airport name it should display the flights numbers.
which is the correct way to lay it out,

thanks lindsey
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Lindsey,
well, if u work in java u should try to think in OO terms.
if i were u, then i'd see the whole picture as,
1. Airport object,
2. Airport allows many airlines to run,
3. each airline runs many flights to various locations.
so the objects here are,
1. airport
2. airline
3. flight


hope this helps...
this way ur design would be better than dealing with maze of arrays...
regards
maulin
Lindsey Ship
Greenhorn

Joined: Feb 07, 2003
Posts: 19
Thank Maulin
It makes sense what you say, but I am only in my 4th week of java with only 2hours a week on it.
We have been told to do this assignment in arrays.
Please don't send me the code as I do not want to cheat.
What I need to know if I am doing the right array or not as we have been told we could ask advise only.
What would be great for me,if one of your ranchers could advise me by e-mail.
I could send my code and problem, they would only have to say your on the right trail, or back up and look at your last piece of code ect
That way with a helping hand from a expert I think I would learn java the best way.
So what the heck ! any one fancy advising a real novice, promise not to bomb-bar you with e-mails
Well thanks agains I have printed your answer for when we use vectors.
Take care you all on the ranch
Lindsey
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Lindsey!
i would go with the first array you created...
{ {{"paris", "234", "sfssfa" , "453" } ....}
that sounds better.
also, in your code where you have following part,

you don't need run the third for loop as you already know the structure of the array and that the array element of index 2 is the destination.
so instead of the third for loop you just write,

you get what i mean?
and btw for your statement,

Please don't send me the code as I do not want to cheat.

you are so cute
you will learn best.
good luck.
regards
maulin.
 
Don't get me started about those stupid light bulbs.
 
subject: which of these 2 arrays is right
 
Similar Threads
Flight - Segment another view
don't know how to call method in my new version of code
where is my silly mistake
I'm lost on how to do and call 3d array
where am i calling method in wrong ??