6/7 Opening an Account


#1

Not sure what I am doing wrong. Here is my code

class Account
attr_reader :name, :balance
def initialize(name, balance=100)
@name = name
@balance = balance
end

def display_balance(pin_number)
puts pin_number == pin ? "Balance: $#{@balance}." : pin_error
end

def withdraw(pin_number, amount)
if pin_number == pin
@balance -= amount
puts "Withdrew #{amount}. New balance: $#{@balance}."
else
puts pin_error
end
end

private

def pin
@pin = 1234
end

def pin_error
"Access denied: incorrect PIN."
end
end

my_account = Account.new("Abigail", 100)


#2

Hi here

my_account = Account.new("Abigail", 100)

Your variable name should be checking_acount instead of my_account


#3

I feel dumb lol. Thanks so much!