Java OOP Challenge: Workintech Burger Company
A Java project designed to reinforce the core principles of Object-Oriented Programming (OOP) — specifically Inheritance, Polymorphism, and Encapsulation — by simulating a dynamic burger ordering and pricing system. [Switch to Turkish Version (#türkçe-dokümantasyon) 🇹🇷]
🇬🇧 English Documentation
This repository contains an object-oriented solution for a fast-food management system, focusing on extending base class behaviors, overriding methods, and handling custom subclass states.
🚀 Features & Objectives
- Base Class Architecture (Hamburger) Objective: Form the core foundation of a standard burger with essential parameters: name, meat, price, and breadRollType. Customization: Supports tracking up to four distinct additions (additionName and additionPrice) through dedicated methods. Pricing Flow: The itemizeHamburger() method acts as a print receipt builder, dynamically printing added components and returning the total calculated price.
- Fixed-Package Variant (DeluxeBurger) Objective: Model a luxury combo meal that strictly prohibits custom additions. State Control: Automatically encapsulates two final properties: cips ("Curvy") and drink ("Coke") via the constructor with a predefined base price of 19.10$. Polymorphic Restraints: Overrides all base addition methods to prevent modification, printing an error message instead of mutating the burger structure.
- Dietary Specialty Variant (HealthyBurger) Objective: Implement a health-conscious variant with immutable structural constraints (meat is fixed as "Tofu"). Extended State: Allows up to two extra specialized healthy additions (healthyExtra1 and healthyExtra2) beyond the standard addition capacity. Polymorphic Calculations: Overrides itemizeHamburger() to append healthy items into the breakdown and aggregate their values into the receipt total.
🛠️ Tech Stack Language: Java 11 / 17+ Core Concepts: Inheritance, Method Overriding, Encapsulation IDE: IntelliJ IDEA
🇹🇷 Türkçe Dokümantasyon
Bu depo, nesne yönelimli programlama prensiplerini (Kalıtım, Polimorfizm, Kapsülleme) kullanarak bir hamburger sipariş ve fiyatlandırma otomasyonunu simüle eden Java çözümlerini içermektedir.
🚀 Özellikler ve Hedefler
- Ana Sınıf Mimarisi (Hamburger) Hedef: Bir hamburgerin temel bileşenlerini (name, meat, price, breadRollType) ve fiyat yapısını kurgulamak. Esneklik: Tüketicinin isteğine göre eklenebilecek 4 farklı ek malzemeyi (additionName, additionPrice) hafızada tutar. Hesaplama Döngüsü: itemizeHamburger() metodu fiş dökümü görevi görerek eklenen malzemeleri ekrana basar ve toplam güncel tutarı hesaplayıp geriye döner.
- Sabit Menü Varyasyonu (DeluxeBurger) Hedef: Dışarıdan ekstra malzeme kabul etmeyen, içeriği standartlaştırılmış lüks bir menü modellemek. İçerik Yönetimi: Constructor tetiklendiğinde otomatik olarak cips ("Curvy") ve drink ("Coke") bileşenlerini atar. Varsayılan taban fiyatı 19.10$ olarak set edilir. Polimorfik Kısıtlamalar: Üst sınıftan gelen tüm malzeme ekleme metotları override edilerek etkisiz hale getirilmiştir. Malzeme eklenmeye çalışıldığında hata mesajı verir.
- Diyet Menü Varyasyonu (HealthyBurger) Hedef: Sağlık odaklı içerik kriterlerine sahip (et türü kalıcı olarak "Tofu" olarak belirlenmiş) özel bir sınıf türetmek. Genişletilmiş Yapı: Standart 4 malzemeye ek olarak, sadece bu sınıfa özgü 2 ekstra sağlıklı malzeme alanına (healthyExtra) sahiptir. Fiş Güncellemesi: itemizeHamburger() metodu ezilerek, bu sınıfa ait özel malzemelerin de hesaplamaya ve konsol çıktısına dahil edilmesi sağlanır.
🛠️ Kullanılan Teknolojiler Dil: Java 11 / 17+ Temel Kavramlar: Kalıtım (Inheritance), Metot Ezme (Overriding), Kapsülleme (Encapsulation) IDE: IntelliJ IDEA
📥 Sample Code & Usage / Örnek Kullanım Java Hamburger hamburger = new Hamburger("Basic", "Normal", 3.56, "Wrap"); hamburger.addHamburgerAddition1("Tomato", 0.27); hamburger.addHamburgerAddition2("Lettuce", 0.75); hamburger.itemizeHamburger();
DeluxeBurger db = new DeluxeBurger(); db.addHamburgerAddition1("Should not work", 2.50); // Prints warning db.itemizeHamburger();