Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PC:
- def __init__(self, ozu: int, hard_disk_memory: int, cpu: str):
- self.__ozu = ozu
- self.__hard_disk_memory = hard_disk_memory
- self.__cpu = cpu
- @property
- def getInfoPc(self):
- d = {'ozu': self.__ozu, 'hard_disk_memory': self.__hard_disk_memory, 'cpu': self.__cpu}
- return d
- class Desktop(PC):
- def __init__(self, __ozu, __hard_disk_memory, __cpu, monitor: str, mouse: str, keyboard: str,
- keyboard_width: float, keyboard_length: float):
- super().__init__(__ozu, __hard_disk_memory, __cpu)
- self.__monitor = monitor
- self.__mouse = mouse
- self.__keyboard = keyboard
- self.__keyboard_width = keyboard_width
- self.__keyboard_length = keyboard_length
- def getInfo(self):
- return \
- f'''OZU: {self.getInfoPc['ozu']}
- RAM: {self.getInfoPc['hard_disk_memory']}
- CPU: {self.getInfoPc['cpu']}
- Monitor: {self.__monitor}
- Mouse: {self.__mouse}'''
- class Laptop(PC):
- def __init__(self, diag, *args):
- super().__init__(*args)
- self.__diag = diag
- def getInfoLap(self):
- return \
- f'''OZU: {self.getInfoPc['ozu']}
- RAM: {self.getInfoPc['hard_disk_memory']}
- CPU: {self.getInfoPc['cpu']}
- Диагональ: {self.__diag}'''
- desk = Desktop(16, 256, '2030v3', 'Asus', 'Bloody_v7', 'Razer', 70, 18)
- print(desk.getInfo())
- print()
- lap = Laptop(12, 32, 512, 'intel')
- print(lap.getInfoLap())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement