Skip to content

Instantly share code, notes, and snippets.

/acct.rb Secret

Created October 14, 2015 22:07
Show Gist options
  • Save anonymous/06bdaab5323c6a750fa6 to your computer and use it in GitHub Desktop.
Save anonymous/06bdaab5323c6a750fa6 to your computer and use it in GitHub Desktop.
error line 11...no implicit conversion of string to integer. what am i doing wrong?
class AccountCheck
def initialize(acct)
@acct = acct
@ALL_ACCOUNTS =[1234,5678,9456]
firstCheck(@acct)
end
def addAccount(desiAcct)
puts "Enter your full name."
new_name = gets.chomp
$newAcct = Array.new[desiAcct.to_i, new_name.to_s]
end
def getAccount(acct_num)
@ACCT_ACCOUNTS.each do |acct|
if acct == acct_num
puts "#{acct}"
end
end
end
def firstCheck(acct_input)
@ALL_ACCOUNTS.each do |x|
if acct_input == x
puts "Account Found."
#need to bring up name and account info here LEARN ARRAY IN ARRAY
getAccount(acct_input)
else
#option to create a new account
puts "Not Found...would you like to create one? y/n"
createNew = gets.chomp
if createNew == "y"
puts "Enter your desired Account Number"
desiAccount = gets.chomp
addAccount(desiAccount)
else
puts "Come back again"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment