Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf #137

Merged
merged 1 commit into from
May 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions core/credit_card/management.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime


class CreditCard:
def __init__(self, card_number, limit):
self.card_number = card_number
Expand All @@ -8,6 +9,7 @@ def __init__(self, card_number, limit):
self.interest_rate = 0.05
self.closed = False


def process_payments():
for card in all_cards:
amount_due = card.balance * (1 + card.interest_rate)
Expand All @@ -16,33 +18,42 @@ def process_payments():
else:
card.balance = 0


def process_purchases():
for card in all_cards:
if card.closed:
continue
purchase_amount = float(input(f"Enter purchase amount for card {card.card_number}: "))
purchase_amount = float(
input(f"Enter purchase amount for card {card.card_number}: ")
)
if purchase_amount > card.limit - card.balance:
print(f"PURCHASE DENIED: Insufficient credit for card {card.card_number}")
else:
card.balance += purchase_amount
if card.balance > card.limit:
print(f"WARNING: Credit limit exceeded for card {card.card_number}")


def set_credit_limit(card, limit):
card.limit = limit


def get_credit_limit(card):
return card.limit


def get_balance(card):
return card.balance


def apply_interest(card):
card.balance *= (1 + card.interest_rate)
card.balance *= 1 + card.interest_rate


def deny_credit(card):
card.limit = 0
card.closed = True


# Initialize list of all credit cards
all_cards = []
Loading