• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

which of these 2 arrays is right

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic