Having difficulties with student/course exercise

Hi all,

It might be just not having a good grasp of classes yet, but I’m not sure how to start creating the methods for the student and course exercise. I put in the initialize method and some of the getter methods, but I’m stuck at creating the enroll method and not sure how to start.

All help would be greatly appreciated!

class Student
  def initialize(first_name, last_name)
    @first_name = first_name
    @last_name = last_name
    @courses = []
  end

  def first_name
    @first_name
  end

  def last_name
    @last_name
  end

  def courses
    @courses
  end

  def name
    "#{@first_name} #{@last_name}"
  end

  def enroll(new_course)
    #???
  end
end

when you run spec’s what behavior is being tested for enroll?

you should find that it’s expecting new_course to be added to @courses, so you just need to find a method that will add new_course into the instance variable @cousres to the instance of your Student class.

Thanks John, it makes sense after you broke it down!

Happy to help and happy coding!