Skip to content

Commit

Permalink
merge and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nilz3ro committed Apr 8, 2014
2 parents 60dd12b + 541761c commit 9694342
Showing 1 changed file with 40 additions and 14 deletions.
54 changes: 40 additions & 14 deletions ruby-scripts/bank.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@

require 'date'

class BankAccount

def initialize(first_name, last_name)

# make a object (in ruby it's called a Hash) of all of the info we need,
# make a object of all of the info we need,
# this way it's all in a nice group instead of tons of individual variables

@attr = Hash.new()

@attr["first_name"] = first_name
Expand All @@ -16,34 +20,56 @@ def initialize(first_name, last_name)

end

def deposit(amount)
def deposit

puts "How much would you like to deposit?"

amount = gets.chomp

# this is a test push to see if i am 'gitting' this software correctly no changes have been made other then this comment
# access attribures as an object
# i think you can also do @attr.balance
@attr["balance"] += amount.to_f

message = "$#{amount} has been deposited."
@attr["transactions"] << track("withdrawl")

end

def withdraw

puts "How much would you like to withdraw?"

amount = gets.chomp

@attr["balance"]-= amount.to_f

# push this transaction to the end of the transactions array
@attr["transactions"] << message
@attr["transactions"] << track("withdrawl")

puts message
end

def track(type)

return {

"type" => type,

"time" => DateTime.now(),

"result" => balance()
}

end

def show_balance
def balance

puts "Your current balance is $#{@attr["balance"]}"
puts "Your current balance is $#{@attr['balance']}"

return @attr["balance"]

end

end
def report

bank_account = BankAccount.new("Chocolate", "Tomato")
puts@attr

bank_account.deposit(200)
bank_account.show_balance
end

end

0 comments on commit 9694342

Please sign in to comment.