From cb8758d60291525260283ed6458a4b5bf7d7b53f Mon Sep 17 00:00:00 2001 From: Cezary Adamczak Date: Tue, 12 Oct 2021 21:26:15 +0200 Subject: [PATCH] APO-1 Created base for the projects --- .gitignore | 50 ++++++++++++++++++++ init.py | 13 +++++ main.py | 9 ++-- src/bank/data/allCards.py | 5 -- src/cards/__pycache__/cards.cpython-38.pyc | Bin 385 -> 0 bytes src/cards/cards.py | 6 --- src/modules/Account.py | 10 ++++ src/modules/Card.py | 13 +++-- src/modules/__pycache__/Card.cpython-38.pyc | Bin 491 -> 0 bytes src/tools/__pycache__/tools.cpython-38.pyc | Bin 422 -> 0 bytes src/tools/tools.py | 9 ++-- 11 files changed, 91 insertions(+), 24 deletions(-) create mode 100644 .gitignore create mode 100644 init.py delete mode 100644 src/bank/data/allCards.py delete mode 100644 src/cards/__pycache__/cards.cpython-38.pyc delete mode 100644 src/cards/cards.py create mode 100644 src/modules/Account.py delete mode 100644 src/modules/__pycache__/Card.cpython-38.pyc delete mode 100644 src/tools/__pycache__/tools.cpython-38.pyc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..88315da --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +bin/ +build/ +develop-eggs/ +dist/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Rope +.ropeproject + +# Django stuff: +*.log +*.pot + +# Sphinx documentation +docs/_build/ \ No newline at end of file diff --git a/init.py b/init.py new file mode 100644 index 0000000..de33c21 --- /dev/null +++ b/init.py @@ -0,0 +1,13 @@ +cards = [ + {"number": "1111222233334444", "type": "Credit", "pin": "1234"}, + {"number": "2222333344445555", "type": "Prepaid", "pin": "2345"}, + {"number": "3333444455556666", "type": "ATM", "pin": "3456"}, + {"number": "444666", "type": "University ID", }, +] + +accounts = [ + {}, + {}, + {}, + {}, +] \ No newline at end of file diff --git a/main.py b/main.py index b964256..279ec4a 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,10 @@ -from src.cards.cards import cards from src.tools.tools import * from src.modules.Card import Card +from src.modules.Account import Acount +import init + + card = cards[int(input("Chose a card from 1 to " + str(len(cards)) + ": ")) - 1] - - -PrintCardInfo(Card(card["number"], card["name"], card["surname"], card["type"])) \ No newline at end of file +PrintCardInfo(Card(card["number"], card["pin"], card["type"])) \ No newline at end of file diff --git a/src/bank/data/allCards.py b/src/bank/data/allCards.py deleted file mode 100644 index 277c58b..0000000 --- a/src/bank/data/allCards.py +++ /dev/null @@ -1,5 +0,0 @@ -cards = [ - {"number": "1111222233334444", "name": "John", "surname": "Doe", "type": "Credit", "pin": "1234", "clientID": "1234abcd"}, - {"number": "2222333344445555", "name": "Jane", "surname": "Doe", "type": "Prepaid", "pin": "2345", "clientID": "2345bcde"}, - {"number": "3333444455556666", "name": "Eric", "surname": "Gudmundson", "type": "ATM", "pin": "3456", "clientID": "3456cdef"}, -] \ No newline at end of file diff --git a/src/cards/__pycache__/cards.cpython-38.pyc b/src/cards/__pycache__/cards.cpython-38.pyc deleted file mode 100644 index 5b11601eaa0197e9eba6a558aac914f8b92a5cee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 385 zcmYk2&q@O^5XQ4@x~;XV>l=98Lk0g-L`1Ewh=N+Ey@d4;cY;PuvLw5O`YgVHue4X+ zLOeJd5&8@B@eRXFl9@$OpCBjlfxCc^uO?Zhhsi01J3s*f0kohE^n*eNLiAnld$0n1 zSoMAY5v;*_q!L?xBi4_Hxz~cYmO>rM#^uo%V^)D+>l?G?GtJmdP+C|(W= gE9aTBdFDI+bgNj@y(49ydK1U3W|hrO2Z297zu7QloB#j- diff --git a/src/cards/cards.py b/src/cards/cards.py deleted file mode 100644 index 14babe9..0000000 --- a/src/cards/cards.py +++ /dev/null @@ -1,6 +0,0 @@ -cards = [ - {"number": "1111222233334444", "name": "John", "surname": "Doe", "type": "Credit"}, - {"number": "2222333344445555", "name": "Jane", "surname": "Doe", "type": "Prepaid"}, - {"number": "3333444455556666", "name": "Eric", "surname": "Gudmundson", "type": "ATM"}, - {"number": "444666", "name": "Adam", "surname": "Somm", "type": "University ID"}, -] \ No newline at end of file diff --git a/src/modules/Account.py b/src/modules/Account.py new file mode 100644 index 0000000..a87b874 --- /dev/null +++ b/src/modules/Account.py @@ -0,0 +1,10 @@ +class Acount: + def __init__(self, number, name, surname, credit): + self.number = number + self.name = name + self.surname = surname + self.credit = credit + self.cards = [] + + def addCard(self, card): + self.cards.append(card) \ No newline at end of file diff --git a/src/modules/Card.py b/src/modules/Card.py index e034e24..8957e40 100644 --- a/src/modules/Card.py +++ b/src/modules/Card.py @@ -1,7 +1,10 @@ class Card: - def __init__(self, ownerName, ownerSurname, number, type): - self.ownerName = ownerName - self.ownerSurname = ownerSurname - self.number = number - self.type = type + def __init__(self, number, pin, type, account): + self.number = number + self.pin = pin + self.type = type + self.account = account + account.addCard(self) + + \ No newline at end of file diff --git a/src/modules/__pycache__/Card.cpython-38.pyc b/src/modules/__pycache__/Card.cpython-38.pyc deleted file mode 100644 index bdef05f51e527d2c8c4c3af8019fac87cc42dc5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 491 zcmY*Uu};H44E0^ol2+}482Nz=Wn@4I6^g`GkSdla=oE4X3N%UaC7_~g^k?{`W8@Rq zn6ML7Dn7ku`_6v$-HyjYAbZU2k}vY#oa~xM$&_ICiLO9{78}Bcj6ll;gkDPb|4dRg zCD;QZ1Ch`WNiDS8K;&tUdVJ^464Ysr3bw{Ecg_g*kf;$2C}#1$&%^^i0r$xL9zUJLmt|V# zrl@Ruesj&3TqMPFnJ3j`h1qLtF^%(5*Gpq#-u`H{c7ak^kyT2uwhf3t^xN}3Zfmyh zye<{6hpMZ}#Mg>K4F+Jwzr zUDf9&E!p*Y4Na$C7p`L_^_N4W)Mp36u*B((z)T5PWFcGrKOX2uM%EJZz zPUnO8N~UF=38UkS>BORcnTThZC#DbUmsqPbHc~Eh!zabE3Z`~Xdy;GMAnm*8Hi%fa d{!|P3IArx&Z?r=`{#ET^E_u1g&g|?jK>w-oV^IJA diff --git a/src/tools/tools.py b/src/tools/tools.py index ebd6502..4478a0f 100644 --- a/src/tools/tools.py +++ b/src/tools/tools.py @@ -1,5 +1,6 @@ def PrintCardInfo(card): - print("Owner's Name: " + card.ownerName) - print("Owner's Surname: " + card.ownerSurname) - print("Card's Number: " + card.number) - print("Card's Type: " + card.type) \ No newline at end of file + print("Owner's Name: " + card.account.name) + print("Owner's Surname: " + card.account.surname) + print("Card's Number: " + card.number) + print("Card's Type: " + card.type) + print("Card's PIN: " + card.pin) \ No newline at end of file