diff --git a/__pycache__/bank.cpython-314.pyc b/__pycache__/bank.cpython-314.pyc new file mode 100644 index 0000000..77ba917 Binary files /dev/null and b/__pycache__/bank.cpython-314.pyc differ diff --git a/bank.py b/bank.py index ab74f6f..59c55a9 100644 --- a/bank.py +++ b/bank.py @@ -1,184 +1,189 @@ -class Bank: - - def __init__(self, name): - # Manages accounts, transactions, and loans. Generates unique account numbers. - self.name = name - self.accounts = [] - self.transactions = [] - self.loans = [] - - - def create_account(self, account_holder, initial_balance): - # Creates a new account with a unique number and initial balance, add it to accounts array and return account number - pass - - - def get_account(self, account_number): - # Retrieves an account by its number, returns None if not found. - pass - - - def list_accounts(self): - # Lists all accounts with their details like account number, holder, balance - pass - - - def close_account(self, account_number): - # Closes an account by removing it from the list. - pass - - - def transfer_funds(self, from_account, to_account, amount): - # Transfers funds between accounts if sufficient balance is available, return boolean values depending on - # transfer success - pass - - - def generate_account_statement(self, account_number): - # Generates a transaction history for a given account number, return None if no account number found - pass - - - - def calculate_total_assets(self): - # Calculates the total assets by summing all account balances. - pass - - - def process_loan_payments(self): - # Processes loan payments by deducting the installment amount from the balance. - pass - - -class Account: - # Represents a bank account with balance and transactions. Default balance is 0. - def __init__(self, account_number, account_holder, balance=0.0): - self.account_number = account_number - self.account_holder = account_holder - self.balance = balance - self.transactions = [] - - - def deposit(self, amount): - # Deposits a positive amount to the account and records the transaction. When adding transaction to array specift "Deposit" and amount - pass - - - def withdraw(self, amount): - # Withdraws an amount if sufficient balance is available. When adding into transactions array, specify Withdraw and amount - pass - - - def get_balance(self): - # Returns the current balance of the account. - pass - - - def get_transaction_history(self): - # Retrieves the transaction history of the account. - pass - - - def apply_interest(self, rate): - # Applies interest based on a given rate. - pass - - - def overdraft_protection(self, amount): - # Checks if a withdrawal amount is within available balance. - pass - - - def update_contact_information(self, new_contact_info): - # Updates the contact information of the account holder. - pass - - -class Transaction: - # Represents a transaction with an ID, type, amount, and timestamp. - def __init__(self, transaction_id, account_number, amount, transaction_type, timestamp): - self.transaction_id = transaction_id - self.account_number = account_number - self.amount = amount - self.transaction_type = transaction_type - self.timestamp = timestamp - - - def process_transaction(self): - # Processes a transaction if the amount is positive. - return self.amount > 0 - - - def validate_transaction(self): - # Validates the transaction before processing. - return self.amount > 0 - - - def reverse_transaction(self): - # Reverses a transaction by negating the amount. - pass - - -class BankEmployee: - # Represents a bank employee with an ID, name, and role. - def __init__(self, employee_id, name, role): - self.employee_id = employee_id - self.name = name - self.role = role - - - def approve_loan(self, account_number, amount): - # Approves a loan request if the amount is positive. - return amount > 0 - - - def view_account_details(self, account_number): - # Views account details given an account number by returning account number - pass - - - def suspend_account(self, account_number): - # Return suspension message as string - pass - - - def generate_financial_report(self): - # Return string "Financial Report Generated" - return "Financial Report Generated" - - -class Loan: - # Represents a loan with an ID, amount, interest rate, and tenure. - def __init__(self, loan_id, account_number, amount, interest_rate, tenure): - self.loan_id = loan_id - self.account_number = account_number - self.amount = amount - self.interest_rate = interest_rate - self.tenure = tenure - self.remaining_balance = amount - - - def make_payment(self, amount): - # Makes a loan payment if the amount is within the remaining balance. - pass - - - def get_remaining_balance(self): - # Returns the remaining balance of the loan. - pass - - - def calculate_interest(self): - # Calculates interest on the remaining balance. - pass - - - def check_loan_eligibility(self, account_number, income, credit_score): - # Checks if an applicant is eligible for a loan based on income(>50k) and credit score(>650). Return boolean - pass - - # Allows restructuring of the loan with new terms. - def restructure_loan(self, new_terms): - self.tenure = new_terms.get("tenure", self.tenure) - self.interest_rate = new_terms.get("interest_rate", self.interest_rate) - return True +class Bank: + + def __init__(self, name): + # Manages accounts, transactions, and loans. Generates unique account numbers. + self.name = name + self.accounts = [] + self.transactions = [] + self.loans = [] + + + def create_account(self, account_holder, initial_balance): + # Creates a new account with a unique number and initial balance, add it to accounts array and return account number + pass + + + def get_account(self, account_number): + # Retrieves an account by its number, returns None if not found. + pass + + + def list_accounts(self): + # Lists all accounts with their details like account number, holder, balance + pass + + + def close_account(self, account_number): + # Closes an account by removing it from the list. + pass + + + def transfer_funds(self, from_account, to_account, amount): + # Transfers funds between accounts if sufficient balance is available, return boolean values depending on + # transfer success + pass + + + def generate_account_statement(self, account_number): + # Generates a transaction history for a given account number, return None if no account number found + pass + + + + def calculate_total_assets(self): + # Calculates the total assets by summing all account balances. + pass + + + def process_loan_payments(self): + # Processes loan payments by deducting the installment amount from the balance. + pass + + +class Account: + # Represents a bank account with balance and transactions. Default balance is 0. + def __init__(self, account_number, account_holder, balance=0.0): + self.account_number = account_number + self.account_holder = account_holder + self.balance = balance + self.transactions = [] + self.contact_information = {} + + + def deposit(self, amount): + # Deposits a positive amount to the account and records the transaction. When adding transaction to array specift "Deposit" and amount + pass + + + def withdraw(self, amount): + # Withdraws an amount if sufficient balance is available. When adding into transactions array, specify Withdraw and amount + pass + + + def get_balance(self): + # Returns the current balance of the account. + pass + + + def get_transaction_history(self): + # Retrieves the transaction history of the account. + pass + + + def apply_interest(self, rate): + # Applies interest based on a given rate. + pass + + + def overdraft_protection(self, amount): + # Checks if a withdrawal amount is within available balance. + pass + + + def update_contact_information(self, new_contact_info): + # Updates the contact information of the account holder. + if not isinstance(new_contact_info, dict): + return False + + self.contact_information.update(new_contact_info) + return True + + +class Transaction: + # Represents a transaction with an ID, type, amount, and timestamp. + def __init__(self, transaction_id, account_number, amount, transaction_type, timestamp): + self.transaction_id = transaction_id + self.account_number = account_number + self.amount = amount + self.transaction_type = transaction_type + self.timestamp = timestamp + + + def process_transaction(self): + # Processes a transaction if the amount is positive. + return self.amount > 0 + + + def validate_transaction(self): + # Validates the transaction before processing. + return self.amount > 0 + + + def reverse_transaction(self): + # Reverses a transaction by negating the amount. + pass + + +class BankEmployee: + # Represents a bank employee with an ID, name, and role. + def __init__(self, employee_id, name, role): + self.employee_id = employee_id + self.name = name + self.role = role + + + def approve_loan(self, account_number, amount): + # Approves a loan request if the amount is positive. + return amount > 0 + + + def view_account_details(self, account_number): + # Views account details given an account number by returning account number + pass + + + def suspend_account(self, account_number): + # Return suspension message as string + pass + + + def generate_financial_report(self): + # Return string "Financial Report Generated" + return "Financial Report Generated" + + +class Loan: + # Represents a loan with an ID, amount, interest rate, and tenure. + def __init__(self, loan_id, account_number, amount, interest_rate, tenure): + self.loan_id = loan_id + self.account_number = account_number + self.amount = amount + self.interest_rate = interest_rate + self.tenure = tenure + self.remaining_balance = amount + + + def make_payment(self, amount): + # Makes a loan payment if the amount is within the remaining balance. + pass + + + def get_remaining_balance(self): + # Returns the remaining balance of the loan. + pass + + + def calculate_interest(self): + # Calculates interest on the remaining balance. + pass + + + def check_loan_eligibility(self, account_number, income, credit_score): + # Checks if an applicant is eligible for a loan based on income(>50k) and credit score(>650). Return boolean + pass + + # Allows restructuring of the loan with new terms. + def restructure_loan(self, new_terms): + self.tenure = new_terms.get("tenure", self.tenure) + self.interest_rate = new_terms.get("interest_rate", self.interest_rate) + return True