Amazon Interview Question
SDE-2sCountry: India
Interview Type: In-Person
public class Aircraft
{
// Attribute
private String airLine;
// more attributes like model, no of seats etc
}
public class Flight
{
// Attributes
private Location fromLocation;
private Location toLocation;
private TimeStamp expectedDepartureTime;
private TimeStamp expectedArrivalTime;
private CrewInfo crewDetails;
private PassengerInfo passengerDetails;
private TerminalInfo terminalInfo; // this will have info like check-in counter, gate etc
private FlightStatus flightStatus; // this will have actual arrival, departure time, also status of flight
}
public class FIS
{
// Attributes
private List<Flight> arrivalFlights;
private List<Flight> departureFlights;
// Operations
private List<Flight> getArrivalFlights(Location location);
private List<Flight> getDepartureFlights(Location location);
}
public class DisplayManager {
private FIS fis;
private Display display;
public void displayArrivalFlights(){
Location location = LocManager.getCurrentLocation();
List<Flight> flights = fis.getArrivalFlights(location);
display.display(flights);
}
}
}}}
// There can be various display classes based on how you want to display it
// We do not need to bother about MQ, who populates the data etc, as the question clearly specifies
// It is not the responsibility of the display system
I thought of 4 immediate classes:-
---------------------------------
Who produces the arriving . departure feed ?
- AD August 04, 2017Feed pushed to a MQ or what?
Then who has responsibility to consume MQ messeges? What are next classes till updation of display board ?
Any Controller or Manager class - like DashBoard / DashboardController / FlightMonitorController ? What will be their responsibilities ?
What else I'm missing and what correction needed more ?