π Advanced OOP course assignments at SCE College of Engineering
Language: Java | Topics: Interfaces, GUI, Multithreading, Design Patterns
A semester-long project building an Animal Olympics competition system with GUI and multithreading.
βββ HW1_animal_hierarchy/
βββ HW2_gui/
βββ HW3_threads/
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
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. |
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 signalfinishFlag- shared Boolean for finish notification- Synchronized blocks on animal movement to prevent race conditions
Linoy Nisim Pur
Noa Shem Tov
Academic coursework at SCE College of Engineering.