Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🚌 Transport Management System – Java OOP Project

A simple console‑based Java application that demonstrates Object‑Oriented Programming principles through a university transport management simulation.


📋 Table of Contents


📁 Project Structure

After applying the package vu.utms, the source files are organised as follows:

TransportSystem/
├── src/
│ └── vu/
│ └── utms/
│ ├── User.java
│ ├── Student.java
│ ├── Lecturer.java
│ ├── TransportOfficer.java
│ └── TransportDemo.java
├── nbproject/ (NetBeans metadata – optional)
├── build.xml (Ant build file – optional)
├── manifest.mf
└── README.md (this file)

🧠 OOP Concepts Demonstrated

Concept Implementation in this project
Inheritance Student, Lecturer, and TransportOfficer extend the base class User.
Method Overriding (Polymorphism) Each subclass overrides the requestTransport() method to provide role‑specific behaviour.
Polymorphism The main() method treats all objects as User references, yet the correct overridden method is called at runtime.
Abstraction The User class defines a common interface; the concrete subclasses hide implementation details.
Encapsulation Fields are private and accessed via getters/setters (implied).

🚀 How to Compile and Run

Prerequisites

  • Java JDK (version 8 or higher) – Download
  • A terminal / command prompt

Step‑by‑step (from the project root)

  1. Navigate to the src folder:

    cd TransportSystem/src
  2. Compile all Java files (the package structure is automatically recognised):

    javac vu/utms/*.java
  3. Run the main class:

    java vu.utms.TransportDemo

You should see output similar to:

Student Alice requests transport to attend classes for Computer Science.
Lecturer Dr. James requests transport for a departmental field visit.
Transport Officer Mr. Alex is scheduling transport for other users.

🛠️ Using VS Code

If you prefer Visual Studio Code:

  1. Ensure the "Extension Pack for Java" is installed.
  2. Open the project root folder in VS Code.
  3. The Java language server will automatically detect the package structure.
  4. Open TransportDemo.java and click the "Run" triangle above the main method – or press Ctrl+F5.

(No manual compilation needed – the extension compiles all sources on the fly.)

📝 Notes on the Code

  • All classes reside in the package vu.utms.
  • User is the base class; it may be abstract or concrete (depending on your implementation) – but it must provide a method requestTransport() that subclasses override.
  • TransportDemo creates one instance of each user type and invokes requestTransport() on each, demonstrating polymorphic behaviour.

🧪 Extending the Project

You can easily add new user roles:

  1. Create a new class, e.g., Visitor.java, that extends User.
  2. Override requestTransport() with custom logic.
  3. Instantiate it in TransportDemo – the existing code will handle it polymorphically without any changes.

📄 License

This project is for educational purposes only. Feel free to use and modify it for learning Java OOP.

About

A Java console application demonstrating Object-Oriented Programming (OOP) concepts like Inheritance, Method Overriding, and Polymorphism through a University Transport Management System.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages