Skip to contents

A checking account that extends BankAccount with overdraft protection and transaction fees.

Usage

CheckingAccount(
  account_number = "",
  account_holder = "",
  initial_balance = 0,
  overdraft_limit = 500,
  transaction_fee = 1.5
)

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

overdraft_limit

numeric. Maximum overdraft amount allowed.

transaction_fee

numeric. Fee charged for overdraft transactions.

Fields

overdraft_limit

numeric. Maximum overdraft amount allowed.

transaction_fee

numeric. Fee charged for overdraft transactions.

Examples

# Create a checking account with $500 overdraft limit
checking <- CheckingAccount("CHK123", "John Doe", 1000,
                          overdraft_limit = 500, transaction_fee = 1.50)

# Withdraw more than balance (uses overdraft)
withdraw(checking, 1200)
#> Withdrew $1200.00 using overdraft protection (fee: $1.50). New balance: $-201.50