The ticketing system at the airport is broken, and passengers have lined up to board the…
- User
The ticketing system at the airport is broken, and passengers have lined up to board the plane in the incorrect order. The line of passengers has already been created for you, and is stored in the 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 assigns it to the instance variable tickets. 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: Delores Deanna Boarding Group 2: Ella-Louise Dawn Candice Nevaeh Patricia Saba Boarding Group 3: Ayla Everly Austin Boarding Group 4: Xander Adrian Boarding Group 5: Siena Sharon 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 (using the existing order of the tickets ArrayList). 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 t There are no passengers with the same row and boarding group. to the console. public class AirlineTicket { private String[] seats = {"A","B","C","D","E","F"}; private String name; private String seat; private int boardingGroup; private int row;
codepublic AirlineTicket(String name, String seat, int boardingGroup, int row) { this.name = name; if(isValidSeat(seat)) { this.seat = seat; } this.boardingGroup = 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; } - Assistant
To accomplish the tasks described in the AirlineTester class, we will need to fill out the TicketOrganizer class with the necessary methods and constructor. I'll write the code snippets for each requirement below.
TicketOrganizer Class with Constructor and Methods
- User
- Assistant
Let's go ahead and fill out the Billboard class with the add and replace methods to correctly manage the top 10 musicians based on the criteria you've provided. Additionally, I'll make slight modifications to the class comments to fit our context.
- User
Your company is doing some data cleanup, and notices that the list of all users has been getting outdated. For one, there are some users who have been added multiple times.
- Assistant
- User
don't use hashset or iterator
- Assistant
- User
Errors: DataPurgeTester.java: Line 10: You may have forgotten to declare removeName(ArrayList,String) or it's out of scope.
DataPurgeTesterSol.java: Line 10: You may have forgotten to declare removeName(ArrayList,String) or it's out of scope.
Grader.java: Line 119: You may have forgotten to declare removeName(ArrayList,String) or it's out of scope.
Grader.java: Line 135: You may have forgotten to declare removeName(ArrayList,String) or it's out of scope.
Grader.java: Line 151: You may have forgotten to declare removeName(ArrayList,String) or it's out of scope.
Grader.java: Line 167: You may have forgotten to declare removeName(ArrayList,String) or it's out of scope.
- Assistant
The errors you’re encountering indicate a potential issue where the
removeNamemethod is either not declared correctly in the class, not visible from where it's being called, or there's a mismatch in the method signature or parameters.