Advertisement
SomeBody_Aplle

Untitled

Jan 3rd, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.44 KB | None | 0 0
  1. class PC:
  2.     def __init__(self, ozu: int, hard_disk_memory: int, cpu: str):
  3.         self.__ozu = ozu
  4.         self.__hard_disk_memory = hard_disk_memory
  5.         self.__cpu = cpu
  6.  
  7.     @property
  8.     def getInfoPc(self):
  9.         d = {'ozu': self.__ozu, 'hard_disk_memory': self.__hard_disk_memory, 'cpu': self.__cpu}
  10.         return d
  11.  
  12.  
  13. class Desktop(PC):
  14.     def __init__(self, __ozu, __hard_disk_memory, __cpu, monitor: str, mouse: str, keyboard: str,
  15.                  keyboard_width: float, keyboard_length: float):
  16.         super().__init__(__ozu, __hard_disk_memory, __cpu)
  17.         self.__monitor = monitor
  18.         self.__mouse = mouse
  19.         self.__keyboard = keyboard
  20.         self.__keyboard_width = keyboard_width
  21.         self.__keyboard_length = keyboard_length
  22.  
  23.     def getInfo(self):
  24.         return \
  25. f'''OZU: {self.getInfoPc['ozu']}
  26. RAM: {self.getInfoPc['hard_disk_memory']}
  27. CPU: {self.getInfoPc['cpu']}
  28. Monitor: {self.__monitor}
  29. Mouse: {self.__mouse}'''
  30.  
  31.  
  32. class Laptop(PC):
  33.     def __init__(self, diag, *args):
  34.         super().__init__(*args)
  35.         self.__diag = diag
  36.  
  37.     def getInfoLap(self):
  38.         return \
  39. f'''OZU: {self.getInfoPc['ozu']}
  40. RAM: {self.getInfoPc['hard_disk_memory']}
  41. CPU: {self.getInfoPc['cpu']}
  42. Диагональ: {self.__diag}'''
  43.  
  44.  
  45. desk = Desktop(16, 256, '2030v3', 'Asus', 'Bloody_v7', 'Razer', 70, 18)
  46. print(desk.getInfo())
  47. print()
  48. lap = Laptop(12, 32, 512, 'intel')
  49. print(lap.getInfoLap())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement