Created
September 5, 2013 20:27
-
-
Save sirramongabriel/6455715 to your computer and use it in GitHub Desktop.
Interact class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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