added car() class

This commit is contained in:
Ganome 2021-05-30 12:37:11 -06:00
parent b8c1a3abc9
commit 6829b0457a
2 changed files with 11 additions and 35 deletions

View File

@ -5,39 +5,10 @@ class car:
self.__wheels = 4 self.__wheels = 4
self.__windows = 6 self.__windows = 6
self.__doors = 4 self.__doors = 4
self.__horsepower = 100
self.__totaled = False
self.__color = "black"
self.__customized = False
def showOffCar(self):
class computer: print(f"My car still has {self.__wheels} wheels\n{self.__windows} windows,\n{self.__doors} doors are attached,\nTotaled out: {self.__totaled},\nWith {self.__horsepower} horsepower!")
def __init__(self):
self.__CPU = 0
self.__RAM = 0
self.__STORAGE = 0
self.__FIREWALL = 0
self.__AV = 0
self.__OS = 0
self.__NETWORK = 0
def setCPU(self, speed):
self.__CPU = speed
def setRAM(self, ram):
self.__RAM = ram
def setSTORAGE(self, storage):
self.__STORAGE = storage
def setOS(self, os):
self.__OS = os
def setNETWORK(self, network):
self.__NETWORK = network
def newComputer(self, cpu, ram, storage, os, network):
self.__CPU = cpu
self.__RAM = ram
self.__STORAGE = storage
self.__OS = os
self.__NETWORK = network
myPC = computer()
myPC.setCPU(500)
myPC.setRAM(32)
print(myPC._computer__CPU, myPC._computer__RAM)

View File

@ -0,0 +1,5 @@
from car import car
myCar = car()
myCar.showOffCar()