A java based Object-Oriented Programming project that simulates a Virtual Pet sanctuary Where users can adopt, manage and care for virtual pets, events like illness, escape and natural disasters add unpredictablity to the simulation
- User can register
- Login System for careTakers and Managers
- Role based System
- CareTaker manage and care for pets.
- Guest can browse and buy pets without an account.
- Managers handle events pet, assignement, and events.
- User is an abstract class extended by caretaker and manager.
- Multiple pets types(Dog, Horse, Lion, Rabbit).
- Pets have attribute name, age , type, Hunger, mood price, health
- CareTakers can feed, play with and heal assigned pets
- Pet manager allowing adding , removing and updating pets.
- Pet is an abstract class exented for specific pet types.
- Guest can view pets for sale without registrations.
- Only pet marked as isForSale = True is available for sale.
- Managers can manage sanctuary funds.
- Funds can be used as buy pets.
- Playground (Improve pet hpppines).
- Clinic (Increase pet health).
- Feeding Station (Reducese pet hunger).
- Random events affects pets.
- Illness: (Pet health deacreases).
- Escape: An unhappy pet leaves the sanctuary.
- Natural Disasters Affects multiple pets.
- Eventmanager stores and manage events.
- CareTakers can resolve events for assigned pets.
- users.txt->Store registered users.
- pets.txt->stores pets details.
- Events.txt-> Stores events history.
- Java(JDK + 17)-> Core programming language
- OOP Principles ->Encapsulation, inheritance , polymorphism, Abstraction, Agggregtion, Composition.
- File Hanlding ->Persientnce of users, pets, and events.
- Git and Github ->Version control and Collaboration.
📦 Virtual-Pet-Sanctuary-Simulator ┣ 📂 src ┃ ┣ 📂 Sanctuary ┃ ┃ ┣ 📜 Sanctuary.java // Main System Controller ┃ ┃ ┣ 📜 Main.java // Entry point of program ┃ ┣ 📂 User ┃ ┃ ┣ 📜 User.java // Abstract Base Class ┃ ┃ ┣ 📜 Manager.java // Handles finances, upgrades, reports ┃ ┃ ┣ 📜 CareTaker.java // Manages pet interactions ┃ ┃ ┣ 📜 UserManager.java // Handles login & registration ┃ ┃ ┣ 📜 Interactable.java // Interface for user actions ┃ ┣ 📂 Pet ┃ ┃ ┣ 📜 Pet.java // Abstract Base Class for all pets ┃ ┃ ┣ 📜 Dog.java // Concrete Pet Class ┃ ┃ ┣ 📜 Rabbit.java // Concrete Pet Class ┃ ┃ ┣ 📜 Horse.java // Concrete Pet Class ┃ ┃ ┣ 📜 Lion.java // Concrete Pet Class ┃ ┃ ┣ 📜 PetManager.java // Handles pet creation & management ┃ ┃ ┣ 📜 InteractPet.java // Interface for pet actions ┃ ┣ 📂 Event ┃ ┃ ┣ 📜 Event.java // Event class (Illness, Escape, Disaster) ┃ ┃ ┣ 📜 EventManager.java // Handles event creation & resolution ┃ ┃ ┣ 📜 EventTriggerable.java // Interface for event behavior ┃ ┣ 📂 Guest ┃ ┃ ┣ 📜 Guest.java // Allows non-registered users to buy pets ┣ 📂 data ┃ ┣ 📜 users.txt // Stored user accounts ┃ ┣ 📜 pets.txt // Stored pet data ┃ ┣ 📜 events.txt // Stored event history
git clone https://github.com/your-username/Virtual-Pet-Sanctuary.git cd Virtual-Pet-Sanctuary javac -d bin src/**/*.java java -cp bin Main This project is open-source under the MIT License. 1️ Encapsulation Private fields (e.g., username, password, hunger) Getters/Setters for controlled access2️
User → Parent class of Manager & Caretaker Pet → Parent class of Dog, Rabbit, Horse, Lion3️
interactWithPet() (User Subclass) behaves differently for Manager vs CareTaker play(), eat(), heal() (Pet Subclasses) overridden in Dog, Rabbit, etc.4️
Sanctuary contains UserManager, PetManager, and EventManager UserManager manages a list of users5️
PetManager manages a list of pets EventManager triggers events on pets