Class: AccountGem
- Inherits:
-
Object
- Object
- AccountGem
- Defined in:
- lib/AccountGem.rb
Instance Attribute Summary collapse
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#name ⇒ Object
Returns the value of attribute name.
-
#num ⇒ Object
Returns the value of attribute num.
Instance Method Summary collapse
- #depositAccount(num, amount) ⇒ Object
-
#initialize(numr, nameA, income) ⇒ AccountGem
constructor
A new instance of AccountGem.
- #withDrawAmount(num, amount) ⇒ Object
Constructor Details
#initialize(numr, nameA, income) ⇒ AccountGem
Returns a new instance of AccountGem.
5 6 7 8 9 10 |
# File 'lib/AccountGem.rb', line 5 def initialize numr,nameA,income puts "in AccountGem initialize " @num= numr @name= nameA @balance = income end |
Instance Attribute Details
#balance ⇒ Object
Returns the value of attribute balance.
3 4 5 |
# File 'lib/AccountGem.rb', line 3 def balance @balance end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/AccountGem.rb', line 3 def name @name end |
#num ⇒ Object
Returns the value of attribute num.
3 4 5 |
# File 'lib/AccountGem.rb', line 3 def num @num end |
Instance Method Details
#depositAccount(num, amount) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/AccountGem.rb', line 13 def depositAccount num, amount puts "depositAccount for #{num} with #{amount}" @balance+=amount end |
#withDrawAmount(num, amount) ⇒ Object
20 21 22 23 |
# File 'lib/AccountGem.rb', line 20 def withDrawAmount num, amount puts "withDrawAmount for #{num} with #{amount}" @balance-=amount end |