kareemgrant
5/27/2015 - 1:25 AM

robot.rb

#1) Create a Robot class
#2) add an initialize method that accepts 
## one attribute "name"
#3) Add reader and writer methods (long way)
#4) Add a talk method that has the robot say its name
#5) Create 3 robots, larry, curly and moe
#6) Change curly's name to "shemp"

class Robot
  attr_accessor :name

  def initialize(name)
    @name = name
  end

  # def name
  #   @name
  # end

  # def name=(new_name)
  #   @name = new_name
  # end

  def talk
    "hello my name is #{name}"
  end
end

robot1 = Robot.new("larry")
robot2 = Robot.new("curly")
robot3 = Robot.new("moe")

puts robot1.talk
puts robot2.talk
puts robot3.talk

robot1.name = "shemp"
puts robot1.talk