Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''' Design a class named Stock to represent a company's stock.
- It contains:
- symbol
- name
- previousClosingPrice
- currentPrice
- '''
- class Stock:
- def __init__(self, a, b, c, d):
- self.symbol = a
- self.name = b
- self.previousClosingPrice = c
- self.currentPrice = d
- def getStockName(self):
- return self.name
- def getStockSymbol(self):
- return self.symbol
- def seteazaStocAnterior(self, stockAnterior):
- self.previousClosingPrice = stockAnterior
- def veziStocAnterior(self):
- return self.previousClosingPrice
- def seteazaPretCurent(self, pretCurent):
- self.currentPrice = pretCurent
- def veziPretCurent(self):
- return self.currentPrice
- def getChangeProcent(self):
- return self.previousClosingPrice / self.currentPrice * 100
- IntelCorporation = Stock("INTC", "Intel Corporation", 20.5, 20.35)
- print(IntelCorporation.getChangeProcent())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement