------art_20953_11734751.1162559382805
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I am a newbie to Ruby and the output of the following program is not clear
to me.

The program is:

class Accounts
  attr_accessor :balance

  def initialize(name, phone, op_balance)
    @name  ame
    @phone  hone
    @balance  p_balance
  end

  def deposit(amt)
    @balance + mt
    puts @balance.to_s
  end
end

class Savings<Accounts
  def initialize(name, phone, op_balance)
    super
  end

  def withdraw(amt)
    @bal  alance
    if ((@bal - amt) > 500.00)
      balance  bal - amt
      puts balance.to_s
    else
      puts 'No Balance'
    end
  end
end

s  avings.new('Pete',65241884,5000.00)
s.deposit(500.00)
s.withdraw(200.00)
puts s.balance.to_s

The output I get is:

>ruby accounts.rb
5500.0
5300.0
5500.0
>Exit code: 0

I thought that the last line puts s.balance.to_s would have displayed 5300.0.
Why is this 5500.0 ?

All help appreciated.

------art_20953_11734751.1162559382805--