Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from abc import ABC, abstractmethod
- class Magazin():
- def __init__(self, denumire, adresa, oras):
- self.denumire = denumire
- self.adresa = adresa
- self.oras = oras
- @abstractmethod
- def setDenumire(self):
- pass
- def afiseaza(self):
- print(self.denumire + " " + self.adresa + " " + self.oras + " ", end =" ")
- class magazinLegumeFructe(Magazin):
- def __init__(self, denumire, adresa, oras, tipMagazin):
- super().__init__( denumire, adresa, oras)
- self.tipMagazin = tipMagazin
- def setDenumire(self):
- self.denumire = denumire
- def setTipMagazin(self):
- self.tipMagazin = tipMagazin
- def afiseaza(self):
- super().afiseaza()
- print(self.tipMagazin)
- class Legume():
- def __init__(self, tip, dataExpirari):
- self.tip = tip
- self.dataExpirari = dataExpirari
- def setTip(self, tip):
- self.tip = tip
- def afisare():
- print(self.tip + " " + dataExpirari + " ", end = " ")
- class Fructe():
- def __init__(self, tip, culoare):
- self.tip = tip
- self.culoare = culoare
- def setTip(self, tip):
- self.tip = tip
- def afisare():
- print(self.tip + " " + culoare + " ", end = " ")
- class Morcov(Legume):
- def __init__(self, tip, dataExpirari, lungime, pret):
- super().__init__(tip, dataExpirari)
- self.lungime = lungime
- self.pret = pret
- def setLungime(self, lungime):
- self.lungime = lungime
- def afisare():
- super().afisare()
- print(self.lungime + " " + self.pret)
- class Varza(Legume):
- def __init__(self, tip, dataExpirari, diametru, pret):
- super().__init__(tip, dataExpirari)
- self.diametru = diametru
- self.pret = pret
- def setDiametru(self, diametru):
- self.diametru = diametru
- def afisare():
- super().afisare()
- print(self.diametru + " " + self.pret)
- class Cumparaturi():
- def __init__(self):
- morcov1 = Morcov(input("tip morcov:"), input("data expirari: "), input("lungime: "), input("pret: "))
- morcov2 = Morcov(input("tip morcov:"), input("data expirari: "), input("lungime: "), input("pret: "))
- varza1 = Varza(input("tip morcov:"), input("data expirari: "), input("diametru: "), input("pret: "))
- varza2 = Varza(input("tip morcov:"), input("data expirari: "), input("diametru: "), input("pret: "))
- pretCump = float(morcov1.pret) + float(morcov2.pret) + float(morcov1.pret) + float(varza1.pret) + float(varza2.pret)
- print("in total s-a cheltuit " + str(pretCump) + " lei")
- Cumparaturi()
Add Comment
Please, Sign In to add comment