APO-1 Created base for the projects

This commit is contained in:
Cezary Adamczak 2021-10-12 21:26:15 +02:00
parent ed20a714a5
commit cb8758d602
11 changed files with 91 additions and 24 deletions

50
.gitignore vendored Normal file
View File

@ -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/

13
init.py Normal file
View File

@ -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 = [
{},
{},
{},
{},
]

View File

@ -1,9 +1,10 @@
from src.cards.cards import cards
from src.tools.tools import * from src.tools.tools import *
from src.modules.Card import Card 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] card = cards[int(input("Chose a card from 1 to " + str(len(cards)) + ": ")) - 1]
PrintCardInfo(Card(card["number"], card["pin"], card["type"]))
PrintCardInfo(Card(card["number"], card["name"], card["surname"], card["type"]))

View File

@ -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"},
]

View File

@ -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"},
]

10
src/modules/Account.py Normal file
View File

@ -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)

View File

@ -1,7 +1,10 @@
class Card: class Card:
def __init__(self, ownerName, ownerSurname, number, type): def __init__(self, number, pin, type, account):
self.ownerName = ownerName
self.ownerSurname = ownerSurname
self.number = number self.number = number
self.pin = pin
self.type = type self.type = type
self.account = account
account.addCard(self)

View File

@ -1,5 +1,6 @@
def PrintCardInfo(card): def PrintCardInfo(card):
print("Owner's Name: " + card.ownerName) print("Owner's Name: " + card.account.name)
print("Owner's Surname: " + card.ownerSurname) print("Owner's Surname: " + card.account.surname)
print("Card's Number: " + card.number) print("Card's Number: " + card.number)
print("Card's Type: " + card.type) print("Card's Type: " + card.type)
print("Card's PIN: " + card.pin)