import java.util.Scanner;

public int getDuration()
{

  int flights;
  System.out.println("Please enter the time of flight departure!");
  Scanner input = new Scanner(System.in); 

  System.out.println("Please enter the time of flight arrival!");
  Scanner input = new Scanner(System.in);

 if (flights == 0)
 {
   return 0;
 }
 else
 {
   double start = 0;
   double end = 0;

  double time = 0;

  time = end - start;

  return time;
 }
}

1a

The point of this code is to figure out whether any flights are available in the airport. The code uses an if else statement to figure that out, by using the properties of the class getDuration and then calculates the time taken for the flight based on when it departs and when it arrives.

public int getShortestLayover()
{
 if (flights.size() < 2) {
    return(0);
 }
 else
 {
    int shortest = getDuration();
        for (int i = 0; i < flights()-1; i++) {
            arrive = flights.getArrivalTime();
            Time leave = getDepartureTime();
            int layover = leave - arrival;
            if (layover < shortest)
            {
            shortest = layover;
            }
        }
 return(shortest);
 }
}

1b

This code essentially uses an if else statement to figure out which flights are closest to when one arrives, and to do so uses a if else statement, saying that if two flights are less than 2 (two flights connecting) then the code returns 0, or else it finds the time and arrival times, calculates the layover for each array and then sorts each value based on its value, and returns it.