6 open an account why it's not working?


#1

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 "Withdraw #{amount}. New balance: $#{@balance}."
    else
        puts "pin_error"
    end
end 
private 
  def pin
    @pin = 1234
  end
  def pin_error
    return "Access denied: incorrect PIN."
  end

end

checking_account = Account("Eric", 100)


#2

Missing : in ternary expression.


#3

end

checking_account = Account("Eric", 100) <== you are missing to made checking_account a NEW instance of Account.


#4