class Item(object):
def __init__(self, ID, name, price, stock ):
self.ID = ID
self.name = name
self.price = price
self.stock = stock
def getID(self):
return self.ID
def getName(self):
return self.name
def getPrice(self):
return self._price
def setPrice(self,value):
self.price = value
def buyStock(self, howMany):
self.stock += howMany
def sellStock(self, howMany):
if howMany <= self.stock:
self.stock -= howMany
return True
else:
return False
def __str__(self):
return str(self.ID) + " " + self.name + " $%0.2f " %self.price + str(self.stock)
Ive started this program but i need this program to use the Item class but provide the same functionality as it already does. Then it needs to save and then load it capabilities.
Please Help