Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andychongyz/a919e70d3a4063c0d5d8 to your computer and use it in GitHub Desktop.
Save andychongyz/a919e70d3a4063c0d5d8 to your computer and use it in GitHub Desktop.
class BankAccount
def initialize(customer_name, type, acct_number)
@customer_name = customer_name
@type = type
@acct_number = acct_number
end
def get_customer_name
@customer_name
end
def set_customer_name(customer_name)
@customer_name = customer_name
end
def get_type
@type
end
def set_type(type)
@type = type
end
def get_acct_number
@acct_number
end
def set_acct_number(acct_number)
@acct_number = acct_number
end
def to_s
"Account name: #{@customer_name}. Type: #{@type}. Account Number: #{@acct_number.gsub!(/\d{3}-\d{3}/){"***-***"}}"
end
end
andy = BankAccount.new("andy", "Saving", "140-558-966")
puts andy.to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment