from abc import ABC, abstractmethod
import datetime
from typing import List
class Item(ABC):
_loanDuration = 14
@classmethod
def getLoanDuration(cls):
return cls._loanDuration
@classmethod
def setLoanDuration(cls, newDuration):
cls._loanDuration = newDuration
def __init__(self, title: str, yearPublished: int, cost: float):
self._title = title
self._yearPublished = yearPublished
self._cost = cost
@property
def title(self):
return self._title
@property
def yearPublished(self):
return self._yearPublished
@property
def cost(self):
return self._cost
@abstractmethod
def getAdminCharge(self):
return self.getAdminCharge
@abstractmethod
def getFinesPerDay(self):
return self.getAdminCharge
def lostCharges(self):
return self.getAdminCharge() + self._cost
def __str__(self):
return f"{self._title} {self._yearPublished} Cost: ${self._cost}"
C1 = Item("Asia Food And Culture","2019","30")
print(C1)
暂无答案!
目前还没有任何答案,快来回答吧!