Skip to content

Instantly share code, notes, and snippets.

@sirramongabriel
Created September 5, 2013 20:27
Show Gist options
  • Select an option

  • Save sirramongabriel/6455715 to your computer and use it in GitHub Desktop.

Select an option

Save sirramongabriel/6455715 to your computer and use it in GitHub Desktop.
Interact class
# interact.rb
require_relative './account'
class Interact
def initialize(account)
@account = account
end
def start_transaction
puts "#{greeting} Please type 'balance', 'withdraw', or 'deposit' to begin your transaction."
grab_trans_type = gets.chomp
case grab_trans_type
when 'balance'
puts "Your current account balance is #{@account.balance}, thank you."
when 'withdraw'
puts "Enter the ammount you wish to withdraw from your account."
amount = gets.chomp
@account.withdraw(amount.to_f)
when 'deposit'
puts "Enter the ammount you wish to deposit into your account."
amount = gets.chomp
@account.deposit(amount.to_f)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment