• Post Reply Bookmark Topic Watch Topic
  • New Topic

airline ticket generator  RSS feed

 
tevin billings
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys I'm new to java and have been doing some exercises.one in particular is where I have to prompt the user to enter their details,such as name, surname and ID number.i then have to generate a random number for each persons info I put in.the part I'm lost at is where I have to create a multidimensional array to store the information generated from the ticket and then ask the user if they want to view the passenger list and then print the passenger list with the user's information.now I know there will be a multidimensional array and for loops but I'm not exactly sure how to do this
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

First, that exercise sounds like a good example of how NOT to do things in Java.

Next, is this homework or self-study? If it's homework, then don't you have any notes from class? What part of your textbook are you on? That should have information about how to use loops with nested arrays.

Next, Java doesn't have true multidimensional arrays. You can simulate them using nested arrays. That is, arrays whose elements are themselves arrays. Nesting of arrays can be multiple levels deep.

If you are doing self study, then refer to the Official Java Tutorials.
 
tevin billings
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is self study,I've been searching the internet for help based on what I'm doing.i tried loading the code I've done so far but doesn't seem to want to upload.i have a brief understanding of what an array is,declaring it ,etc.where I'm stuck is how to take the information generated from the ticket and creating an array to take that info and displaying it on a list for the user to see
 
Stephan van Hulst
Saloon Keeper
Posts: 7992
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forget arrays for now. Arrays are for multiple instances of the same type of thing. You want to gather related but different types of things about a person together, so you should be creating a class for that.

Create a Person class, and show to us that you can create an instance of it and fill it with data that a user entered. Don't worry about a complete passenger list yet.
 
tevin billings
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I add the code to coderanch?
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't post all your code; only post the parts you think has problems. UseCodeTags (← click) when posting code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!