Skip to content

noasht/Advanced_OOP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Advanced Object Oriented Programming

πŸ† Advanced OOP course assignments at SCE College of Engineering

Language: Java | Topics: Interfaces, GUI, Multithreading, Design Patterns


🎯 Project Theme: Animal Olympics πŸ¦πŸ…

A semester-long project building an Animal Olympics competition system with GUI and multithreading.


πŸ—‚οΈ Project Structure

β”œβ”€β”€ HW1_animal_hierarchy/
β”œβ”€β”€ HW2_gui/
└── HW3_threads/

πŸ“ Assignments

Assignment 1: Class Hierarchy & Foundations

Topics: Inheritance, Interfaces, Abstract Classes, Encapsulation

Built a complete animal hierarchy for the Olympics system:

Package Description
Olympics Medal class with enum type (BRONZE, SILVER, GOLD), tournament name, and year.
mobility ILocatable interface, Point class for coordinates, abstract Mobile class tracking total distance traveled.
animals Abstract Animal class with name, speed, and medals array.

Animal Hierarchy:

Mobile (abstract)
β”œβ”€β”€ TerrestrialAnimal (abstract)
β”‚   β”œβ”€β”€ Dog
β”‚   β”œβ”€β”€ Cat (with castration status)
β”‚   └── Snake (with toxicity level: low/medium/high)
β”œβ”€β”€ WaterAnimal (abstract)
β”‚   β”œβ”€β”€ Whale
β”‚   β”œβ”€β”€ Dolphin
β”‚   └── Alligator (also Terrestrial - uses Delegator pattern)
└── AirAnimal (abstract)
    β”œβ”€β”€ Eagle (with altitude and wingspan)
    └── Pigeon

Assignment 2: GUI & Interfaces

Topics: Swing GUI, Event Handling, Interfaces, Exceptions

Added graphical interface to the Olympics system:

Class Description
CompetitionFrame Main JFrame window with menu and controls. Contains the main() method.
ZooPanel JPanel for drawing and animating animals on screen.
AddAnimalDialog JDialog for adding new animals with input validation.

Interfaces Implemented:

Interface Description
IDrawable Methods for loading images and drawing animals: loadImages(), drawObject().
IMoveable Methods for animal movement: getAnimalName(), getSpeed(), move().
IAnimal Combines IMoveable with animal-specific behavior.
IClonable For cloning animal objects.

Assignment 3: Multithreading & Concurrency

Topics: Threads, Synchronization, wait/notify, Race Conditions

Added real-time race simulation with multithreading:

Class Description
AnimalThread Implements Runnable. Moves animal forward, waits for start signal, notifies on finish. Uses synchronized blocks and wait()/notify().
Scores Thread-safe score storage using Collections.synchronizedMap(). Records finish times.
Referee Waits for animals to finish, records their times to Scores.
Tournament Manages multiple competitions and coordinates threads.

Competition Types:

Type Animals
πŸƒ Running Dog, Cat, Snake, Alligator
🏊 Swimming Whale, Dolphin, Alligator
πŸ¦… Flying Eagle, Pigeon

Thread Synchronization:

  • startFlag - shared Boolean for race start signal
  • finishFlag - shared Boolean for finish notification
  • Synchronized blocks on animal movement to prevent race conditions

πŸ‘©β€πŸ’» Contributors

Linoy Nisim Pur
Noa Shem Tov


πŸ“„ License

Academic coursework at SCE College of Engineering.

About

Advanced Object-Oriented Programming course assignments (Java)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages