Making a Withdrawal


#1

class Account
attr_reader :name,:balance

def initialize(name,balance=100)
    @name=name
    @balance=balance
end
private
def pin
    @pin=1234
end
def pin_error
    "Access denied: incorrect PIN."
end     
public
def display_balance(pin_number)
    if pin_number==pin
        puts "Balance $#{@balance}."
    else
        puts 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

end
end

Really do not understand why it keeps asking me if I defined a withdrawal method. I can't get this to go.


#2

@blogue,

you are not closing the IF ELSE with an =end=
in your display_balance method