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:

Answers

Answer 1
Answer:

Answer:

See explaination

Explanation:

The program code

import java.util.ArrayList;

public class Main

{

public static void main(String[] args)

{

ArrayList<AirlineTicket> tickets = new ArrayList<AirlineTicket>();

//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("\nPassengers Ordered by Boarding Group:");

ticketOrganizer.printPassengersByBoardingGroup();

System.out.println("\nPassengers in line who can board together:");

ticketOrganizer.canBoardTogether();

}

//Do not touch this method! It is adding random passengers to the AirlineTicket array

public static void addPassengers(ArrayList<AirlineTicket> tickets)

{

String[] seats = {"A","B","C","D","E","F"};

for(int index = 0; index< 15; index++)

{

int random = (int)(Math.random() * 5);

AirlineTicket ticket = new AirlineTicket("Passenger " + (index+1), seats[random], ((int)(Math.random()*5)+1), ((int)(Math.random()*8)+1));

tickets.add(ticket);

}

}

}

class TicketOrganizer

{

private ArrayList<AirlineTicket> tickets ;

//constructor with parameter as an arraylist of AirlineTicket

public TicketOrganizer(ArrayList<AirlineTicket> tickets)

{

this.tickets = tickets;

}

//methhods to return the arraylist of airlines

public ArrayList<AirlineTicket> getTickets()

{ //re-organize the ticket first

ArrayList<AirlineTicket> tickets_organized = new ArrayList<AirlineTicket>();

for(int i=1; i<=5; i++)

{

for(AirlineTicket ticket: tickets)

{

if(ticket.getBoardingGroup() == i)

{

tickets_organized.add(ticket);

}

}

}

return tickets_organized;

}

//print the tickets based on boardingGroup

public void printPassengersByBoardingGroup()

{

int count = 0;

for(int i=1; i<=5; i++)

{

System.out.println("Boarding Group " + i + ":");

for(AirlineTicket ticket : tickets)

{

if(ticket.getBoardingGroup() == i)

{

System.out.println("Passenger " + ticket.getName());

}

}

}

See attachment for sample output


Related Questions

What is computer virus?
software that interprets commands from the keyboard and mouse is also known as the? A. desktop B. Operating system C. operating disk D. hard drive
In the 2018-2019 softball season, Allison hit the ball 28 out of 67 times, this included fouls. What was her percentageof misses?
"Packet switches have multiple links attached to them. For each attached link the packet switch has a/an ____________, which stores packets that the router is about to send into that link."link bufferaccess bufferoutput buffertransmission buffernone of the above
why is the disk method a special case of the general slicing​ method? choose the correct answer below. a. the cross sections of the slices are disks with holes through them. b. the functions that generate the solids are all lines. c. the functions that generate the solids are all parabolas. d. the cross sections of the slices are disks.

Select the true statement(s) regarding a virtual circuit. a. both analog and digital networks take advantage of the virtual circuit concept
b. virtual circuits require the assignment of dedicated physical links during network connection
c. regarding the efficient use of physical links, virtual circuits are more efficient than analog circuits
d. both a and b are true statements"

Answers

Answer:

The correct option is D

Explanation:

Generally for a virtual circuit   both analog and digital networks take advantage of the virtual circuit concept

Generally virtual circuits require the assignment of dedicated physical links during network connection

 Generally regarding the efficient use of physical links,  virtual circuits are NOT more efficient than analog circuits

What should a web page designer consider when choosing between fixed positioning and absolute positioning?O Fixed positioning is the HTML default element flow, while absolute positioning is relative to the browser window.
O Fixed positioning is an offset placement from the normal element layout, while absolute positioning is the HTML
default element flow
Fixed positioning is relative to the browser window, while absolute positioning is located at a specific place on a
web page.
Fixed positioning is located at a specific place on a web page window, while absolute positioning is an offset
placement from the normal element layout.

Answers

Answer:

Fixed positioning is relative to the browser window, while absolute positioning is located at a specific place on a web page.

Answer:

c

Explanation: trust me bro

Which of the following function declarations correctly expect an array as the first argument?Question 1 options:

void f1(int array, int size);

void f1(int& array, int size);

void f1(int array[100], int size);

void f1(float array[], int size);

All of the above

C and D

A and B

Answers

Answer:

Only

Option: void f1(float array[], int size);

is valid.

Explanation:

To pass an array as argument in a function, the syntax should be as follows:

functionName (type arrayName[ ] )

We can't place the size of the array inside the array bracket (arrayName[100]) as this will give a syntax error. The empty bracket [] is required to tell the program that the value that passed as the argument is an array and differentiate it from other type of value.

Interchanges of ideas in forums and internet news groups are functions of which domain?

Answers

I believe that the answer to the question provided above is that the  Interchanges of ideas in forums and internet news groups are functions of the information domain.
Hope my answer would be a great help for you.    If you have more questions feel free to ask here at Brainly.

Discuss and compare shared and switch Ethernet

Answers

Answer:

Shared ethernet is the type of virtual input and output server components that is used to connect physical ethernet to the virtual ethernet in the network.

In the shared ethernet, the physical network easily access by the virtual network. It uses stand alone server for communication in the network.

On the other hand, switch ethernet uses the point to pint connection between the segment and host.

Switch ethernet has dedicated bandwidth and it is also known as desktop switching ethernet. In the switch ethernet, the hub is replace with the switching hub in the network.    

6 things you should consider when planning a PowerPoint Presentation.

Answers

Answer: I would suggest you consider your audience and how you can connect to them. Is your presentation, well, presentable? Is whatever you're presenting reliable and true? Also, no more than 6 lines on each slide. Use colors that contrast and compliment. Images, use images. That pulls whoever you are presenting to more into your presentation.

Explanation: