I am trying to create a program that generates plane tickets and after that it asks the user if they want to see the passenger list.
What I am struggling with is that after every user that has input their details, they must get added to the passenger list. So if User1 enters his details and must get asked if they want to see the passenger list (so far there will be only one record under the passenger list), then wen User2 enters his details it must ask the user if they want to see the passenger list and the User2 details must get added to the passenger list (so we will have 2 records under the passenger list) and so on..
Please assist with that.
public class Question12 {
public static void main(String[] args) {
double random = Math.random()* 69 + 1;
String q;
Scanner in = new Scanner(System.in);
String[][] PlaneTicket = new String[3][3];
for (int row = 0; row < 67; row++) {
System.out.print("Enter name:");
PlaneTicket[row][0] = in.next();
System.out.print("Enter surname: ");
PlaneTicket[row][1] = in.next();
System.out.print("Enter a ID: ");
PlaneTicket[row][2] = in.next();
System.out.println("************Airport**********");
System.out.println("Seat number: " + Math.round(random));
System.out.println("Name: " + PlaneTicket[row][0]);
System.out.println("Surname: " + PlaneTicket[row][1]);
System.out.println("ID: " + PlaneTicket[row][2]);
System.out.println("*****************************");
System.out.println("Do you want to view the passanger list: " + "(Yes/No)");
q = in.next();
if ("Yes".equals(q)) {
System.out.println("Name Surname ID Seat Number");
System.out.println("----------------------------------------");
System.out.println(PlaneTicket[row][0]+" "+PlaneTicket[row][1]+" "+PlaneTicket[row][2]+ " "+ Math.round(random));