<file_sep>class CarOwner

  attr_reader :name
  @@all = []

  def initialize(name)
    @name = name
    @@all << self
  end

  def self.all
    @@all
  end

  def cars
    Car.all.select{|car| car.owner == self}
  end

  def mechanics
    # car_class = cars.map{|car| car.classification}
    cars.map{|car| car.mechanic}
  end

  def self.average
    Car.all.count/all.count
  end


end
<file_sep>require_relative '../app/models/mechanic.rb'
require_relative '../app/models/car.rb'
require_relative '../app/models/car_owner.rb'
require_relative '../config/environment.rb'
require 'pry'
def reload
  load 'config/environment.rb'
end

co1 = CarOwner.new("Aaron")
co2 = CarOwner.new("Ed")
co3 = CarOwner.new("Scott")

mech1 = Mechanic.new("Danielle", "small car")
mech2 = Mechanic.new("Flatiron", "sports car")
mech3 = Mechanic.new("Will", "classic car")

car1 = Car.new("Mini", "Clubman", "small car", mech1, co1)
car2 = Car.new("Ferrari", "California", "sports car", mech2, co3)
car3 = Car.new("Ferrari", "<NAME>", "sports car", mech2, co2)
car4 = Car.new("Datsun", "280z", "classic car", mech3, co2)


binding.pry
0<file_sep>class Mechanic

  attr_reader :name, :specialty
  @@all = []
def initialize(name, specialty)
  @name = name
  @specialty = specialty
  @@all << self
end

def self.all
  @@all
end

def cars
  Car.all.select{|car| car.mechanic == self}
end

def car_owners
  cars.map{|car| car.owner}.uniq
end

def car_owner_names
  car_owners.map{|owner| owner.name}
end


end
