Class Airport
java.lang.Object
Airport
Airport.java
Airport class maintains a collection of Flights that use this airport.
Airport class maintains a collection of Flights that use this airport.
- Version:
- Sep 30, 2024
- Author:
- cs230 staff (YY)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFlight
(Flight f) Adds the given flight to the airport.Flight[]
findFlightsByAirline
(String inputAirline) Takes in the name of an airline, and returns all the flights of this airline that use this airportstatic void
void
printFlightsByAirline
(String inputAirline) Takes in the name of an airline, and prints all its flights that use this airporttoString()
Returns a String representation of this airport
-
Constructor Details
-
Airport
Constructor for objects of class Airport
-
-
Method Details
-
addFlight
public void addFlight(Flight f) Adds the given flight to the airport. Assumes this flight has not already been using this airport, (ie it is not already in the array). If the airport reaches capacity, increase its capacity to accommodate more flights.- Parameters:
f
- A new flight to be added to this airport
-
toString
Returns a String representation of this airport -
findFlightsByAirline
Takes in the name of an airline, and returns all the flights of this airline that use this airport- Parameters:
the
- name of the airline of interest- Returns:
- an array containing all flights of the given airline that use this airport
-
printFlightsByAirline
Takes in the name of an airline, and prints all its flights that use this airport- Parameters:
the
- name of the airline of interest
-
main
-