#CPU/RAM/Disk
class CPU(object):
def __init__(self,brand,core,interface):
self.brand=brand
self.core=core
self.interface=interface
class RAM(object):
def __init__(self,brand,size):
self.brand=brand
self.size=size
class Disk(object):
def __init__(self,brand,size):
self.brand=brand
self.size=size
class Computer(object):
def __init__(self,cpu_interface,ram_count,disk_count):
self.cpu_interface=cpu_interface
self.ram_count=ram_count
self.disk_count=disk_count
self.__cpu=None
self.__rams=[]
self.__disks=[]
def add_cpu(self,cpu):
if cpu.interface==self.cpu_interface:
self.__cpu=cpu
else:
print("cpu型号不对,不能安装电脑")
def add_ram(self,ram):
if len(self.__rams)==self.ram_count:
print("内存条已经没有位置进行安装了")
else:
self.__rams.append(ram)
def add_disk(self,disk):
if len(self.__disks)==self.disk_count:
print(&#