You will be creating a credit card class for each of the following \"lssuing Net
ID: 3808955 • Letter: Y
Question
You will be creating a credit card class for each of the following "lssuing Networks" Visa, Mas- terCard, American Express, and Discover. Give each module as well as the class it contains the appropriate name of the "lssuing Network" (e.g. Visa.py contains the Visa class) You will notice that much of the data and operations is similar or the same across the classes, but there is enough variance to warrant individual class definitions (you might consider how you could abstract the common elements, though) Data Each card has the following information. All monetary values are in USD and are to be rounded to two decimal places (cents). Card Number 4 sets of 4 numbers for Visa, MasterCard, and Discover Ex: 4716 5944 7443 4320 Sets of 4,6,5 numbers respectively for American Express Ex: 3744 294625 08606Explanation / Answer
#this should be in Card.py
import abc
import datetime
import locale
locale.setlocale( locale.LC_ALL, 'English_United States.1252')
class Card(object):
balance=0
paymentduedates={}
def __init__(self,name,dateissued,expirationdate,securitycode):
self.name=name
self.expirationdate=datetime.datetime.strptime(expirationdate, '%d%m%Y').date()
self.dateissued=datetime.datetime.strptime(dateissued, '%d%m%Y').date()
self.securitycode=securitycode
@abc.abstractmethod
def minimalpayment():
return
def addcharge(self,amount):
self.balance=self.balance+amount
round(self.balance)
def getBalance(self):
return locale.currency(self.balance)
@abc.abstractmethod
def makepayment():
return
----------------------------------------
#this should be in visa.py
from Card import Card
class Visa(Card):
def __init__(self,cardnumber,name,dateissued,expirationdate,securitycode,a1,a2):
self.cardnumber=cardnumber
self.a1=a1
self.a2=a2
super(Visa, self).__init__(name,dateissued,expirationdate,securitycode)
def minimalpayment(self):
pass
def makepayment(self):
pass
-------------------------------------------
#this should be in CreditCards.py
from Visa import Visa
v= Visa("1123 1111 1121 1111","ash","21051999","21052020","1231",9,10)
v.addcharge(100)
print(v.getBalance())
------------------------------
similaryly do for all cards
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.