This is a command-line application that allows users to manage and search for flight routes within Malaysia. Users can add or remove airports and flight routes, view the entire flight network, and find the shortest flight path between two airports.
- View Airports: Display a list of all available airports.
- Manage Airports: Add or remove airports (vertices) from the network.
- Manage Routes: Add or remove flight routes (edges) between airports.
- Find Shortest Path: Utilizes Breadth-First Search (BFS) to find the shortest flight path between two selected airports.
- Search Routes: Search for all available flight routes from a specific airport.
- Java Development Kit (JDK) version 11 or newer.
- Visual Studio Code with the Extension Pack for Java
-
Download and Extract the Project Zip File: Right-click the zip file and select Extract All (Windows) or Extract Here (Linux/macOS). After extraction, you will see an additional folder created (DSA_ASSIGNEMENT/DSA_ASSIGNEMENT/). Open the inner folder that contains src/, Json/, and lib/ directories. This is the correct project root.
-
Open in Visual Studio Code: Open VS Code Go to File → Open Folder. Select the extracted folder that directly contains the src/ folder.
The project is pre-configured to run in Visual Studio Code. The launch.json file is set up to launch the application.
The project uses the gson-2.13.1.jar library for JSON data handling, which is located in the lib/ directory. Make sure your VS Code Java project settings correctly reference this library.
If the library is not automatically detected, you can manually configure it by following these steps:
-
Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+Pon macOS). -
Type "Explorer: Focus on Java Projects View" and select it.
-
In the "Referenced Libraries" section, click the "Add" button.
-
Navigate to the
lib/directory and select thegson-2.13.1.jarfile. -
This will add the library to your project's classpath. You should see an entry in your
.vscode/settings.jsonfile similar to this:"java.project.referencedLibraries": [ "lib/gson-2.13.1.jar" ]
-
Run the application by opening the
src/Main.javafile and pressingF5or by using the "Run and Debug" panel in VS Code. -
The main menu will be displayed in the terminal, providing the following options:
- [1] Create Graph: Allows you to add or remove airports and flight routes.
- [2] Search for an Airport: Lets you search for all available routes from a specific airport.
- [3] View Malaysia Flight Network: Finds and displays the shortest path between two airports.
- [0] Exit: Exits the application.
The flight route data is stored in Json/route.json. This file contains a map of airports and their direct connections. The application reads from and writes to this file to manage the flight network.