Skip to content

isura3147/Defence-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Defence System

This project is a simple defense system simulator created to practice and demonstrate object-oriented programming (OOP) concepts in Java.
The system features a main controller that manages various defense units, including a Helicopter, a Tank, and a Submarine.


Features

  • Multiple defense units: Supports three types of defense units — Helicopter, Tank, and Submarine.
  • Centralized control: A MainController allows the user to manage and interact with all defense units from a single interface.
  • Real-time communication: Defense units can send and receive messages from the main controller in real time.
  • Observer pattern: The system uses the observer pattern to notify all defense units of any changes in the environment (e.g., "Area Clear").

OOP Concepts Illustrated

This project demonstrates the following key OOP concepts:

  • Inheritance:
    The Helicopter, Tank, and Submarine classes all implement the SuperDefence interface, inheriting its methods and providing their own specific implementations.

  • Polymorphism:
    The MainController can interact with all defense units through the SuperDefence interface, regardless of their specific type, allowing greater flexibility and extensibility.

  • Encapsulation:
    Each defense unit encapsulates its own data (e.g., ammo count, fuel level) and methods, hiding the internal implementation details from other objects.

  • Observer Pattern:
    The MainControllerObservable class acts as an observer, notifying all registered defense units of any changes in the environment, promoting loose coupling between the main controller and the defense units.


Getting Started

To run the project, you'll need:

  • Java installed on your system
  • NetBeans IDE for running the application

Steps:

  1. Clone the repository to your local machine.
  2. Open the project in NetBeans.
  3. Run the Starter.java file to start the application.

How to Use

  1. The main controller window will appear, along with the windows for each defense unit.
  2. Use the main controller to send messages to the defense units — either individually or as a broadcast.
  3. Mark the area as "clear" to enable the defense units' weapons.
  4. Each defense unit has its own controls, including:
    • Sliders for fuel and ammo
    • Buttons for firing weapons

Built with Java and NetBeans to demonstrate core OOP principles in a fun and interactive way.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages