Parcel Tracker is a JavaFX application designed to simulate a logistics and delivery network. The application visualizes processing facilities on a map, manages the routing of various parcel types (Standard, Tracked, and Medical), and calculates delivery costs based on specific criteria. It features an animated graphical user interface (GUI) to demonstrate the movement of parcels between facilities.
- Visual Simulation: Graphical representation of processing facilities and the connections (paths) between them.
- Animated Deliveries: Specific animations showing parcels moving from sender to recipient across the network.
- Parcel Prioritization: A priority stack system that processes parcels in a specific order:
- Medical Parcels (High Priority)
- Tracked Parcels (Medium Priority)
- Standard Parcels (Low Priority)
- Cost Calculation: Dynamic pricing logic based on parcel type:
- Standard: Based on weight (kg).
- Tracked: Based on the number of hops/locations visited.
- Medical: Based on biohazard level.
- Receipt Generation: Outputs a text file (
receipts.txt) summarizing processed deliveries.
Display.java: The main entry point of the application. It handles the JavaFX GUI, animations, and user interaction (buttons).Data.java: Manages data persistence. It reads configuration files (txtandcsv), initializes the network map, and sorts parcels into the processing stack.ProcessingFacility.java: Represents a node in the delivery network with X/Y coordinates and a list of neighbor connections.
Parcel.java: The abstract base class defining common attributes (sender, recipient, ID, price).MedicalParcel.java: Handles high-priority biohazard materials. Price increases with biohazard level.TrackedParcel.java: Maintains a history of locations visited. Price increases based on distance/hops.StandardParcel.java: Basic delivery items. Price is calculated based on weight (kg).
To run this project, you need:
- Java Development Kit (JDK): Version 17 or higher.
- JavaFX SDK: Included in the module path.
- Build Tool: Maven or Gradle (recommended).
This project requires the following libraries defined in module-info.java:
javafx.controls,javafx.fxml,javafx.weborg.controlsfx.controlscom.dlsc.formsfxnet.synedra.validatorfxorg.kordamp.ikonli.javafxorg.kordamp.bootstrapfx.coreeu.hansolo.tilesfxcom.almasb.fxgl.all
- Clone the repository:
git clone <repository-url>
- Open in an IDE: IntelliJ IDEA or Eclipse is recommended.
- Configure Dependencies: Ensure Maven/Gradle downloads the required libraries listed above.
- Data Files: Ensure the following files exist in the root project directory (see Data File Formats below).
- Run the Application: Execute the
mainmethod inDisplay.java. - Control Panel:
- Start Deliveries / Next Delivery: Click this button to animate the processing of the next parcel in the stack.
- Print Receipts: Generates a summary of all processed parcels into a text file.
- Visualization: Watch as parcel icons (boxes, medical kits, pins) travel along the blue lines connecting the facilities.
The application relies on three specific text files in the root directory to initialize the simulation.
Defines the coordinates of the facilities.
- Format:
X_Coordinate Y_Coordinate - Example:
50 50 200 100 400 300
Defines the paths between facilities using their generated addresses. Note: Addresses are generated as X<x_coord>Y<y_coord>.
- Format:
Facility1_Address Facility2_Address - Example:
X50Y50 X200Y100 X200Y100 X400Y300
Defines the parcels to be delivered. The format varies by parcel type.
- Format:
SenderAddress,RecipientAddress,Type,ExtraInfo - Examples:
- Standard:
X50Y50,X400Y300,Standard,2.5(Last value is Weight) - Medical:
X200Y100,X50Y50,Medical,2(Last value is Biohazard Level) - Tracked:
X50Y50,X400Y300,Tracked,(Or simplySender,Recipient)
- Standard:
receipts.txt: Created after clicking "Print Receipts". It contains details such as Parcel ID, Type, Price, and specific attributes (Weight, Biohazard Level, etc.).
aliy112005 Coursework Project