Last active
December 18, 2015 16:49
-
-
Save jwo/5814432 to your computer and use it in GitHub Desktop.
The before picture. Your job, should you choose to accept it: make it better!
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
class User | |
def initialize(first_name, last_name) | |
@firstName = first_name | |
@lastName = last_name | |
end | |
def full_name | |
"#{@lastName} #{@firstName}" | |
end | |
def account | |
Account.for_user(self) | |
end | |
def isActive | |
if account.balance > 0 | |
return true | |
else | |
return false | |
end | |
end | |
end | |
class Account | |
def self.for_user(user) | |
new | |
end | |
def balance | |
[50, 150, 2500].sample | |
end | |
end | |
def users | |
[ | |
User.new("Frank", "Gleason"), | |
User.new("Bill", "Simmons"), | |
User.new("Sarah", "Coderson") | |
] | |
end | |
puts "----------User Account Balance Report ---------------------" | |
users.each do |user| | |
if user.isActive | |
puts user.full_name | |
puts user.account.balance | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment