Skip to contents

A fundamental bank account class that provides basic banking operations including deposits, withdrawals, and balance management with proper validation.

Usage

BankAccount(account_number = "", account_holder = "", initial_balance = 0)

Arguments

account_number

character. Unique identifier for the account.

account_holder

character. Name of the account holder.

initial_balance

numeric. Initial account balance (must be non-negative).

Fields

account_number

character. Unique identifier for the account.

account_holder

character. Name of the account holder.

balance

numeric. Current account balance (must be non-negative).

Examples

# Create a basic bank account
account <- BankAccount("ACC123", "John Doe", 1000)

# Perform basic operations
deposit(account, 500)
#> Deposited $500.00. New balance: $1500.00
withdraw(account, 200)
#> Withdrew $200.00. New balance: $800.00
get_balance(account)
#> [1] 1000
get_account_info(account)
#> === Account Information ===
#> Account Number: ACC123
#> Account Holder: John Doe
#> Current Balance: $1000.00
#> Account Type: s7examples::BankAccount
#> ===========================