Advertisement
Guest User

facebook_broken

a guest
Aug 10th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.18 KB | None | 0 0
  1. class Users
  2.   attr_accessor :name, :email, :num_friends, :friends, :photos #reader and writer for these attributes
  3.   attr_writer :password #writer for password attribute
  4.   attr_reader :url #reader for url attribute
  5.  
  6.   def initalize(name, email, password)
  7.     @name = name
  8.     @email = email
  9.     @password = password
  10.     @url = url
  11.     @statuses = []
  12.     @photos = []
  13.     @friends = []
  14.     @num_friends
  15.   end
  16.  
  17.   def update_status(new_status)
  18.     @statuses << new_status
  19.   end
  20.  
  21.   def upload_photo(new_photo)
  22.     @photos.push(new_photo)
  23.   end
  24.  
  25.   def add_friend(new_friend)
  26.     @num_friends + 1
  27.     @friends.push(new_friend)
  28.   end
  29.  
  30.   def wall
  31.     puts "Here is #{@name}'s wall:"
  32.     puts "#{@name} has #{@num_friends}."
  33.     puts "STATUSES:"
  34.     puts @statuses.each do |status|
  35.       puts status
  36.     end
  37.     puts "PHOTOS:"
  38.     puts @photos.each do |photo|
  39.       puts photo
  40.     end
  41.   end
  42.  
  43. aj = User.new("AJ", "kittens4life@gmail.com", "skittles123", "aj-friendly")
  44. aj.email = "aj@gmail.com"
  45. aj.update_status("what up facebook!")
  46.  
  47. ben = User.new("Ben", "b@en.com", "password1")
  48.  
  49. aj.add_friend("ben")
  50. aj.upload_photo("<picture of> kittenz on fleek<3")
  51. aj.wall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement