diff --git a/exercicios/para-casa/vehicle_home.py b/exercicios/para-casa/vehicle_home.py new file mode 100644 index 0000000..1c26aed --- /dev/null +++ b/exercicios/para-casa/vehicle_home.py @@ -0,0 +1,40 @@ +class Vehicle: + def __init__(self, hallmark, model, age, especification, value_base): + self.hallmark = hallmark + self.model = model + self.age = age + self.especification = especification + self.value_base = value_base + + def calculate_taxes(self): + self.value_base = round(self.value_base * 1.1) + return self.value_base + +class Car(Vehicle): + def __init__(self, hallmark, model, age, especification, value_base): + super().__init__(hallmark, model, age, especification, value_base) + self.value_base = value_base + + def calculate_discount(self): + resume = round(self.value_base * 0.95) + return resume + + +class Motorcycle(Vehicle): + def __init__(self, hallmark, model, age, especification, value_base): + super().__init__(hallmark, model, age, especification, value_base) + self.value_base = value_base + + def calculate_taxes_m(self): + self.value_base = round(self.value_base * 1.05) + return self.value_base + +car = Car(f"BMW", "i7 Sedan", 2024, "4 Doors Eletric", 1282950) +print(" BMW Model i7 Sedan 2024 4 Doors Eletric\n", + "Value Base", car.calculate_taxes(),"\n" + " Value to pay", car.calculate_discount(),"\n\n") + +motorcycle = Motorcycle(f"BMW", "1250 GS", 2024, "Cylinder 1254", 95990 ) +print(" BMW Model 1250 GS 2024 Cylinder 1.254\n", + "Value Base", motorcycle.calculate_taxes(),"\n" + " Value to pay", motorcycle.calculate_taxes_m()) \ No newline at end of file diff --git a/exercicios/para-sala/accountbank.py b/exercicios/para-sala/accountbank.py new file mode 100644 index 0000000..68d99b3 --- /dev/null +++ b/exercicios/para-sala/accountbank.py @@ -0,0 +1,43 @@ +# Titular = holder +# Saldo = balance +# Numero da conta = account_number + +class AccountBank(): + def __init__(self, account_number, holder): + self.account_number = account_number + self.holder = holder + self.balance = 0.0 + + def deposit(self, value): + if value > 0: + self.balance =+ value + print(f"Deposit value R${value}, Successesfully done.") + else: + print("the deposit amount must be greater than 0 ") + + def withdraw(self, value): + if value > 0: + if self.balance >= value: + self.balance -= value + print(f"Withdraw R${value}, Successesfully done") + else: + print("Insufficient balance to withdraw.") + else: + print("The withdrawal amount must be greater than zero") + +contaDaviny = AccountBank(202301, "Daviny Letícia") + +contaDaviny.deposit(100) + +contaDaviny.withdraw(10) + +print(contaDaviny.balance) + +contaLais = AccountBank(202302, "Lais") + +contaLais.deposit(80) + +contaLais.withdraw(1000) + # def account_number(self): + # print(f"Account number:\n") + diff --git a/exercicios/para-sala/animalperson.py b/exercicios/para-sala/animalperson.py new file mode 100644 index 0000000..87d2264 --- /dev/null +++ b/exercicios/para-sala/animalperson.py @@ -0,0 +1,42 @@ +# class Animal: +# def __init__(self, name): +# self.name = name + +# def makes_sond(self): +# pass + +# class Dog(Animal): +# def makes_sound(self): +# return f"{self.name} Makes bark" + +# class Cat(Animal): +# def makes_sound(self): +# return f"{self.name} Makes meow" + + +# dog_Beyoncé = Animal("Yummy") +# dog_Beyoncé = makes_sound("Bark Bark") + +class Person: + def __init__(self, nationality, gender, name, age): + self.nationality = nationality + self.gender = gender + self.name = name + self.age = age + + def info(self): + print(self.nationality, self.gender, self.name, self.age) + +class PersonProfessional(Person): + def __init__(self, nationality, gender, name, age, sector, level): + super().__init__(nationality, gender, name, age) + self.setor = sector + self.level = level + + def info(self): + super().info() + print("Sector", self.setor) + print("Level", self.level) + +Beyoncé_DB = PersonProfessional("American","Famele", "Beyoncé", "42", "Singer") +Beyoncé_DB.info() \ No newline at end of file diff --git a/exercicios/para-sala/car.py b/exercicios/para-sala/car.py new file mode 100644 index 0000000..660df4e --- /dev/null +++ b/exercicios/para-sala/car.py @@ -0,0 +1,35 @@ +class Vehicle: + def __init__(self, hallmark, type, year): + self.hallmark = hallmark + self.type = type + self.age = year + +class Car(Vehicle): + def __init__(self, hallmark, type, year, doors): + super().__init__(hallmark, type, year) + self.hallmark = hallmark + self.type = type + self.age = year + self.doors = doors + + def info(self): + print("Hallmark ", self.hallmark, "Type ", self.type, "Year ", self.age + "Doors", self.doors) + +class Motorcycle(Vehicle): + def __init__(self, hallmark, type, year, motor): + super().__init__(hallmark, type, year) + self.hallmark = hallmark + self.type = type + self.age = year + self.motor = motor + + def info(self): + print("Hallmark ", self.hallmark, "Type ", self.type, "Year ", self.age + "Motor", self.motor) + +car = Car("BMW ", "M3 ", "2024 ", "4") +car.info() + +motorcycle = Motorcycle("BMW ", "1250 ", "2024 ", "Two-cylinder ") +motorcycle.info() + + \ No newline at end of file diff --git a/exercicios/para-sala/exercicio.py b/exercicios/para-sala/exercicio.py new file mode 100644 index 0000000..7785771 --- /dev/null +++ b/exercicios/para-sala/exercicio.py @@ -0,0 +1,28 @@ +class cachorro: + def init(self, nome, raca): # metodo construtor + self.nome = nome + self.raca = raca + +def andar(self): +print('estou andando', self.nome) + +def info(self): +print(self.nome, self.raca) + +cachorro_lulu = cachorro('lulu', 'Harrier') +cachorro_rex = cachorro('rex', 'Pinscher') + +# .... N objetos +cachorro_lulu.info() +cachorro_rex.info() +cachorro_lulu.andar() +print(f'nome do meu cachoro: {cachorro_lulu.nome}') + +cachorro_lulu.nome +cachorro_rex.andar() + +b = 1 +a = 2 +print(b.__class__) +resp = b.__add__(a) +print(resp) \ No newline at end of file diff --git a/exercicios/para-sala/extra.py b/exercicios/para-sala/extra.py new file mode 100644 index 0000000..5ba2de6 --- /dev/null +++ b/exercicios/para-sala/extra.py @@ -0,0 +1,36 @@ +class Immobile: + def __init__(self, address, proprietary_name, value_base): + self.address = address + self.proprietary_name = proprietary_name + self.value_base = value_base + + def calculate_rental(self): + return self.value_base + +class House(Immobile): + def __init__(self, address, proprietary_name, value_base, area_ground): + super().__init__(address, proprietary_name, value_base) + self.area_ground = area_ground + + def calculate_rental(self): + resume = self.value_base + (self.area_ground * 5) + return resume + + +class Apartment(Immobile): + def __init__(self, address, proprietary_name, value_base, rooms): + super().__init__(address, proprietary_name, value_base) + self.rooms = rooms + + def calculate_rental(self): + resume = self.value_base + (self.rooms * 300) + return resume + +house_Beyoncé = House("444, Street of glamurously", "Beyoncé", 1500, 300) +apartment_Bruna = Apartment("44, Street of Persistent", "Bruna Bodecam", 1200, 2) + +print("Value of rental R$: ", house_Beyoncé.calculate_rental()) +print("Value of rental R$: ", apartment_Bruna.calculate_rental()) + + + \ No newline at end of file diff --git a/exercicios/para-sala/product.py b/exercicios/para-sala/product.py new file mode 100644 index 0000000..1811c29 --- /dev/null +++ b/exercicios/para-sala/product.py @@ -0,0 +1,28 @@ +class Product: + def __init__(self, name, value): + self.name = name + self.value = value + +class Vinil(Product): + def __init__(self, name, value, weight): + super().__init__(name, value) + self.name = name + self.value = value + self.weight = weight + def info(self): + print("Name ", self.name, "Value R$ ", self.value + "Weight ", self.weight) + +class Digital(Product): + def __init__(self, name, value, megabyte): + super().__init__(name, value) + self.name = name + self.value = value + self.megabyte = megabyte + def info(self): + print("Name ", self.name, "Value R$ ", self.value + "MegaByte", self.megabyte) + +renaissancevinil = Vinil("Renaissance ", "400.00 ", " 20") +renaissancevinil.info() + +renaissancedigital = Digital("Renaissance ", "150.00 ", "30 ") +renaissancedigital.info() \ No newline at end of file diff --git a/exercicios/para-sala/rectangle.py b/exercicios/para-sala/rectangle.py new file mode 100644 index 0000000..0c2917b --- /dev/null +++ b/exercicios/para-sala/rectangle.py @@ -0,0 +1,30 @@ +# Largura +# Altura + +class Rectangle: + def __init__(self, width, height): + self.width = width + self.height = height + + def calculate_area(self): + #print(f"Calculate area{self.width * self.height}") + return self.width * self.height + + def calculate_perimeter(self): + return 2 * (self.width + self.height) + +house_Beyoncé = Rectangle(5.0, 3.0) +print(f"House of Beyoncé, have:\n {house_Beyoncé.calculate_area()} Area") +print(f"House of Beyoncé have {house_Beyoncé.calculate_perimeter()} Of Perimeter") + +house_Bruna = Rectangle(9.0, 10.5) +print(house_Bruna.calculate_area()) +print(house_Bruna.calculate_perimeter()) + + +# rectangle = rectangle(5.0, 3.0) +# area = rectangle.calculate_area() +# perimeter = rectangle.calculate_perimeter() + +# print(f"Area of Rectangle:\n {area}") +# print(f"Perimeter of Rectangle:\n{perimeter}") \ No newline at end of file