Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Users
- attr_accessor :name, :email, :num_friends, :friends, :photos #reader and writer for these attributes
- attr_writer :password #writer for password attribute
- attr_reader :url #reader for url attribute
- def initalize(name, email, password)
- @name = name
- @email = email
- @password = password
- @url = url
- @statuses = []
- @photos = []
- @friends = []
- @num_friends
- end
- def update_status(new_status)
- @statuses << new_status
- end
- def upload_photo(new_photo)
- @photos.push(new_photo)
- end
- def add_friend(new_friend)
- @num_friends + 1
- @friends.push(new_friend)
- end
- def wall
- puts "Here is #{@name}'s wall:"
- puts "#{@name} has #{@num_friends}."
- puts "STATUSES:"
- puts @statuses.each do |status|
- puts status
- end
- puts "PHOTOS:"
- puts @photos.each do |photo|
- puts photo
- end
- end
- aj = User.new("AJ", "kittens4life@gmail.com", "skittles123", "aj-friendly")
- aj.email = "aj@gmail.com"
- aj.update_status("what up facebook!")
- ben = User.new("Ben", "b@en.com", "password1")
- aj.add_friend("ben")
- aj.upload_photo("<picture of> kittenz on fleek<3")
- aj.wall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement