Пример #1
0
def test():
    fresh_aqua = FreshwaterAquarium('FreshAquarium')
    print(fresh_aqua.calculate_comfort())
    controller = Controller()

    print(controller.add_aquarium('FreshwaterAquarium', 'FreshAquarium'))
    print(controller.add_fish("FreshAquarium", "FreshwaterAquarium"))
    print(controller.calculate_value('FreshAquarium'))
Пример #2
0
 def add_aquarium(self, aquarium_type: str, aquarium_name: str):
     if aquarium_type not in ["FreshwaterAquarium", "SaltwaterAquarium"]:
         return "Invalid aquarium type."
     aquarium = FreshwaterAquarium(aquarium_name) if aquarium_type == 'FreshwaterAquarium' \
         else SaltwaterAquarium(aquarium_name)
     self.aquariums.append(aquarium)
     return f"Successfully added {aquarium_type}."
Пример #3
0
 def add_aquarium(self, aquarium_type: str, aquarium_name: str):
     if aquarium_type == "FreshwaterAquarium":
         self.aquariums.append(FreshwaterAquarium(aquarium_name))
         return f"Successfully added {aquarium_type}."
     elif aquarium_type == "SaltwaterAquarium":
         self.aquariums.append(SaltwaterAquarium(aquarium_name))
         return f"Successfully added {aquarium_type}."
     else:
         return "Invalid aquarium type."
Пример #4
0
 def add_aquarium(self, aquarium_type, aquarium_name):
     if aquarium_type != "FreshwaterAquarium" and aquarium_type != "SaltwaterAquarium":
         return "Invalid aquarium type."                     # potential problem
     if aquarium_type == "FreshwaterAquarium":
         self.aquariums.append(FreshwaterAquarium(aquarium_name))
         return "Successfully added FreshwaterAquarium."
     if aquarium_type == "SaltwaterAquarium":
         self.aquariums.append(SaltwaterAquarium(aquarium_name))
         return "Successfully added SaltwaterAquarium."
Пример #5
0
 def add_aquarium(self, aquarium_type: str, aquarium_name: str):
     if aquarium_type == 'FreshwaterAquarium':
         self.aquariums.append(FreshwaterAquarium(aquarium_name))
         return f'Successfully added {aquarium_type}.'
     elif aquarium_type == 'SaltwaterAquarium':
         self.aquariums.append(SaltwaterAquarium(aquarium_name))
         return f'Successfully added {aquarium_type}.'
     else:
         return 'Invalid aquarium type.'
Пример #6
0
 def add_aquarium(self, aquarium_type, aquarium_name):
     if aquarium_type == 'FreshwaterAquarium':
         aquarium = FreshwaterAquarium(aquarium_name)
     elif aquarium_type == 'SaltwaterAquarium':
         aquarium = SaltwaterAquarium(aquarium_name)
     else:
         return 'Invalid aquarium type.'
     self.aquariums.append(aquarium)
     return f'Successfully added {aquarium_type}.'
Пример #7
0
 def add_aquarium(self, aquarium_type: str, aquarium_name: str):
     if aquarium_type != "FreshwaterAquarium" and aquarium_type != "SaltwaterAquarium":
         return "Invalid aquarium type."
     else:
         if aquarium_type == "FreshwaterAquarium":
             aquarium = FreshwaterAquarium(aquarium_name)
         else:
             aquarium = SaltwaterAquarium(aquarium_name)
         self.aquariums.append(aquarium)
         return f"Successfully added {aquarium_type}."
Пример #8
0
 def add_aquarium(self, aquarium_type: str, aquarium_name: str):
     valid_types = ["FreshwaterAquarium", "SaltwaterAquarium"]
     if aquarium_type not in valid_types:
         return "Invalid aquarium type."
     if aquarium_type == "FreshwaterAquarium":
         self.aquariums.append(FreshwaterAquarium(aquarium_name))
         return f"Successfully added {aquarium_type}"
     if aquarium_type == "SaltwaterAquarium":
         self.aquariums.append(SaltwaterAquarium(aquarium_name))
         return f"Successfully added {aquarium_type}"
Пример #9
0
 def add_aquarium(self, aquarium_type, aquarium_name):
     valid_aquariums = ["FreshwaterAquarium", "SaltwaterAquarium"]
     if aquarium_type not in valid_aquariums:
         return "Invalid aquarium type."
     if aquarium_type == valid_aquariums[0]:
         aquarium = FreshwaterAquarium(aquarium_name)
     else:
         aquarium = SaltwaterAquarium(aquarium_name)
     self.aquariums.append(aquarium)
     return f"Successfully added {aquarium_type}."
Пример #10
0
    def add_aquarium(self, aquarium_type: str, aquarium_name: str):
        valid_types = ('FreshwaterAquarium', 'SaltwaterAquarium')
        if aquarium_type not in valid_types:
            return 'Invalid aquarium type.'

        if aquarium_type == valid_types[0]:
            new_aquarium = FreshwaterAquarium(aquarium_name)
        else:
            new_aquarium = SaltwaterAquarium(aquarium_name)

        self.aquariums.append(new_aquarium)
        return f'Successfully added {aquarium_type}.'
Пример #11
0
    def add_aquarium(self, aquarium_type: str, aquarium_name: str):
        valid_type = ('FreshwaterAquarium', 'SaltwaterAquarium')

        if aquarium_type not in valid_type:
            return "Invalid aquarium type."

        if aquarium_type == valid_type[0]:
            new_aquarium = FreshwaterAquarium(aquarium_name)
        elif aquarium_type == valid_type[1]:
            new_aquarium = SaltwaterAquarium(aquarium_name)

        self.aquariums.append(new_aquarium)
        return f"Successfully added {aquarium_type}."
Пример #12
0
# print(plant.__dict__)

dec_rep = DecorationRepository()
dec_rep.add(orn)
dec_rep.add(orn_2)
dec_rep.add(plant)
print(dec_rep.find_by_type("Ornament"))
print(dec_rep.__dict__)
dec_rep.remove(orn_2)
dec_rep.remove(orn_2)

fresh_water_fish = FreshwaterFish("Sladka", "Freshwater", 5.5)
salt_water_fish = SaltwaterFish("Salty", "Saltwater", 8.4)
fresh_water_fish_2 = FreshwaterFish("Freshy2", "FreshFish2", 7)
salt_water_fish_2 = SaltwaterFish("Salty_2", "Saltwater", 4)
fresh_aquarium = FreshwaterAquarium("FreshShitAquarium")
salt_aquarium = SaltwaterAquarium("SaltwaterShitAquarium")
print(fresh_aquarium.add_fish(fresh_water_fish))
fresh_aquarium.add_fish(salt_water_fish)
print(fresh_aquarium.add_fish(fresh_water_fish_2))
salt_aquarium.add_fish(salt_water_fish)
salt_aquarium.add_fish(salt_water_fish_2)
salt_aquarium.remove_fish(salt_water_fish_2)
salt_aquarium.add_decoration(orn)
salt_aquarium.add_decoration(plant)
print(salt_aquarium.__dict__)
fresh_water_fish.eat()
salt_water_fish.eat()
salt_aquarium.feed()
fresh_aquarium.add_decoration(orn)
fresh_aquarium.add_decoration(orn_2)
Пример #13
0
 def create_aquarium(aq_type, aq_name):
     if aq_type == "FreshwaterAquarium":
         return FreshwaterAquarium(aq_name)
     if aq_type == "SaltwaterAquarium":
         return SaltwaterAquarium(aq_name)
Пример #14
0
from project.aquarium.base_aquarium import BaseAquarium
from project.aquarium.freshwater_aquarium import FreshwaterAquarium
from project.aquarium.saltwater_aquarium import SaltwaterAquarium
from project.decoration.decoration_repository import DecorationRepository
from project.decoration.ornament import Ornament
from project.decoration.plant import Plant
from project.fish.base_fish import BaseFish
from project.controller import Controller

# Aquariums
from project.fish.freshwater_fish import FreshwaterFish
from project.fish.saltwater_fish import SaltwaterFish

b = BaseAquarium("Base", 10)
f = FreshwaterAquarium("FreshAQ")
s = SaltwaterAquarium("SaltAQ")

# Fish
fish1 = BaseFish("BaseF", "G", 10, 100)
fish2 = FreshwaterFish("FreshF", "FF", 200)
fish3 = SaltwaterFish("FreshF", "FF", 200)

# Decorations
decor1 = Ornament()
decor2 = Plant()

# Decor Repos
de = DecorationRepository()

# Controllers
co = Controller()