
# Parent class
class Vehicle:
    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year

    def describe(self):
        print(f"{self.year} {self.make} {self.model}")


# Child class
class ElectricVehicle(Vehicle):
    def __init__(self, make, model, year, battery_capacity):
        super().__init__(make, model, year)
        self.battery_capacity = battery_capacity


my_ev = ElectricVehicle("whatever", "Stellaria", "1999", 20000)
my_ev.describe()

# Child class with method overwrite
class ElectricVehicle(Vehicle):
    def __init__(self, make, model, year, battery_capacity):
        super().__init__(make, model, year)
        self.battery_capacity = battery_capacity

    def describe(self):
        print(f"{self.year} {self.make} {self.model} with {self.battery_capacity} kWh battery")



class Battery:
    def __init__(self, capacity):
        self.capacity = capacity

    def describe_battery(self):
        print(f"Battery capacity: {self.capacity} kWh")


class ElectricVehicle:
    def __init__(self, make, model, year, capacity):
        self.make = make
        self.model = model
        self.year = year
        self.battery = Battery(capacity)  #here is the contained class

    def describe(self):
        print(f"{self.year} {self.make} {self.model}")
        self.battery.describe_battery()


ev = ElectricVehicle('Tesla', 'Model 3', 2024, 75)
ev.battery.describe_battery()


class Fleet:
    def __init__(self):
        self.vehicles = []

    def add_vehicle(self, vehicle):
        self.vehicles.append(vehicle)

    def show_all(self):
        for v in self.vehicles:
            v.describe()


"""
Session 8 – Progressive Project: Zoo Management System
---

Starter Code:
class Animal:
    def __init__(self, name, species, age):
        self.name = name
        self.species = species
        self.age = age

    def make_sound(self):
        print("Some generic animal sound")

---

Task 1 – Subclassing Animals
Create subclasses:
- Mammal(Animal)
- Bird(Animal)
Each overrides make_sound() with something species-specific.

---

Task 2 – Add Unique Attributes
Add one new attribute per subclass:
- Mammal: fur_color
- Bird: wing_span
and extend __init__() using super().

---

Task 3 – Create a Zoo Class
The zoo contains animals → composition.
Example structure:

class Zoo:
    def __init__(self):
        self.animals = []

    def add_animal(self, animal):
        self.animals.append(animal)

    def show_all(self):
        for a in self.animals:
            print(f"{a.name} the {a.species}")

---

Task 4 – Populate and Test
- Instantiate several animals of different types.
- Add them to the zoo.
- Loop through and call make_sound() for each.

---

Task 5 – Interaction Extension
Add a Keeper class with a method feed_all(zoo) that prints feeding messages for every animal.
Demonstrates cross-object interaction.

"""

