Help with this java coding puzzle. Code should only be written in the TicketOrganizer class
Hemin 7.4.7: Airline Tickets i public class TicketOrganizer 2. { private ArrayList
tickets; The ticketing system at the airport is broken, and passengers have lined up to board the plane in the incorrect order. This line is represented in an ArrayList tickets in the AirlineTester class. Devise a way to separate passengers into the correct boarding groups. Currently, there is an AirlineTicket class that holds the information for each passengers ticket. They have a name, seat, row, and boarding group. Use the Ticketorganizer class to help fix the order of passengers boarding. First, create a constructor that takes an ArrayList of AirLineTickets and copies it to a class variable ArrayList. Then, create a getTickets method to get the ArrayList of AirlineTickets. In the Ticketorganizer class, create a method called printPassengersByBoardingGroup that prints out the name of the passengers organized by boarding group. The boarding groups go from 1-5, and have been predetermined for you. This should print the boarding group followed by all passengers in the group: Boarding Group 1: Passenger 2 Passenger 9 Passenger 11 Passenger 12 Boarding Group 2: Passenger 4 Boarding Group 3: Passenger 5 Passenger 6 Passenger 7 Passenger 8 Passenger 13 Boarding Group 4: Passenger 14 Boarding Group 5: Passenger 1 Passenger 3 Passenger 10 Passenger 15 You should also create a method named canBoardTogether which determines if passengers already in line in the tickets ArrayList can board with the people they are standing next to in line. If a passenger has the same row and boarding group as the person behind them, this method should print that those two passengers can board together. For instance if Passenger 11 and Passenger 12 are both in Row 3, and in Boarding Group 4, the method would print: Passenger 11 can board with Passenger 12. If there are no passengers that can board together, then it should print that out to the console. The list of passengers you are going to be reorganizing has been created in the AirlineTicketTester public class AirlineTicket private String[] seats = {"A","8","C","D", "E","F"}; private String name; private String seat; private int boarding Group; private int row; public AirlineTicket (String name, string seat, int boardingGroup, int row) this.name = name; if(isvalidseat(seat)) this.seat = seat; this.boarding Group = boardingGroup; this.row = row; private boolean isvalidseat(String seat) boolean isvalidseat = false; for (String elem: seats) if(seat.equals(elem)) isvalidseat = true; return isvalidseat; public String getseat() return this.seat; public String getName() return this.name; public int getBoardingGroup) return this.boardingGroup; public int getRow() return this.row; public string tostring return name + " Seat: " +seat + " ROW: " + row + " Boarding Group: " + boardingGroup; import java.util.ArrayList; public class AirlineTicketTester public static void main(String[] args) ArrayList tickets = new ArrayListO; //This creates a randomized list of passengers addPassengers(tickets); for (AirlineTicket elem: tickets) System.out.println(elem); //This creates a TicketOrganizer object TicketOrganizer ticketOrganizer = new TicketOrganizer(tickets); //These are the methods of the ticketorganizer in action System.out.println(" Passengers Ordered by Boarding Group:"); ticketOrganizer.printPassengersByBoardingGroup(); System.out.println(" Passengers in line who can board together:"); ticketorganizer.canBoardTogetherO; //Do not touch this method! It is adding random passengers to the AirlineTicket array public static void addPassengers (ArrayList tickets; The ticketing system at the airport is broken, and passengers have lined up to board the plane in the incorrect order. This line is represented in an ArrayList tickets in the AirlineTester class. Devise a way to separate passengers into the correct boarding groups. Currently, there is an AirlineTicket class that holds the information for each passengers ticket. They have a name, seat, row, and boarding group. Use the Ticketorganizer class to help fix the order of passengers boarding. First, create a constructor that takes an ArrayList of AirLineTickets and copies it to a class variable ArrayList. Then, create a getTickets method to get the ArrayList of AirlineTickets. In the Ticketorganizer class, create a method called printPassengersByBoardingGroup that prints out the name of the passengers organized by boarding group. The boarding groups go from 1-5, and have been predetermined for you. This should print the boarding group followed by all passengers in the group: Boarding Group 1: Passenger 2 Passenger 9 Passenger 11 Passenger 12 Boarding Group 2: Passenger 4 Boarding Group 3: Passenger 5 Passenger 6 Passenger 7 Passenger 8 Passenger 13 Boarding Group 4: Passenger 14 Boarding Group 5: Passenger 1 Passenger 3 Passenger 10 Passenger 15 You should also create a method named canBoardTogether which determines if passengers already in line in the tickets ArrayList can board with the people they are standing next to in line. If a passenger has the same row and boarding group as the person behind them, this method should print that those two passengers can board together. For instance if Passenger 11 and Passenger 12 are both in Row 3, and in Boarding Group 4, the method would print: Passenger 11 can board with Passenger 12. If there are no passengers that can board together, then it should print that out to the console. The list of passengers you are going to be reorganizing has been created in the AirlineTicketTester public class AirlineTicket private String[] seats = {"A","8","C","D", "E","F"}; private String name; private String seat; private int boarding Group; private int row; public AirlineTicket (String name, string seat, int boardingGroup, int row) this.name = name; if(isvalidseat(seat)) this.seat = seat; this.boarding Group = boardingGroup; this.row = row; private boolean isvalidseat(String seat) boolean isvalidseat = false; for (String elem: seats) if(seat.equals(elem)) isvalidseat = true; return isvalidseat; public String getseat() return this.seat; public String getName() return this.name; public int getBoardingGroup) return this.boardingGroup; public int getRow() return this.row; public string tostring return name + " Seat: " +seat + " ROW: " + row + " Boarding Group: " + boardingGroup; import java.util.ArrayList; public class AirlineTicketTester public static void main(String[] args) ArrayList tickets = new ArrayListO; //This creates a randomized list of passengers addPassengers(tickets); for (AirlineTicket elem: tickets) System.out.println(elem); //This creates a TicketOrganizer object TicketOrganizer ticketOrganizer = new TicketOrganizer(tickets); //These are the methods of the ticketorganizer in action System.out.println(" Passengers Ordered by Boarding Group:"); ticketOrganizer.printPassengersByBoardingGroup(); System.out.println(" Passengers in line who can board together:"); ticketorganizer.canBoardTogetherO; //Do not touch this method! It is adding random passengers to the AirlineTicket array public static void addPassengers (ArrayList