Last active
December 22, 2015 04:28
-
-
Save sirramongabriel/6417196 to your computer and use it in GitHub Desktop.
interact.rb is a file from project banking and is intended to house communication
This file contains 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 greeting | |
puts "Welcome to bank." | |
end | |
def farewell | |
puts "Have a good day, we value your money here at bank." | |
end | |
def select_transaction | |
puts "please type 'balance' to view your current balance, | |
'withdraw' to remove monies and 'deposit' to add monies to your account." | |
trans_type = gets.chomp | |
"#{transaction_type(trans_type)}" | |
end | |
private | |
def transaction_type(trans_type) | |
case trans_type | |
when "balance" | |
puts "Your current_balance is $#{send_balance}" | |
when "deposit" | |
puts "Please enter the amount you wish to deposit." | |
amount = gets.chomp | |
deposit(amount) | |
when "withdraw" | |
puts "Please enter the amount you wish to withdraw." | |
amount = gets.chomp | |
withdraw(amount) | |
else | |
puts "You have entered an invalid selection. Please type one of the three aforementioned transaction types." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment