diff --git a/planet.rb b/planet.rb new file mode 100644 index 00000000..206cfa5c --- /dev/null +++ b/planet.rb @@ -0,0 +1,13 @@ +class Planet + attr_accessor :name, :diameter, :mass, :number_of_moons + def initialize(name, diameter, mass, number_of_moons) + @name = name + @diameter = diameter + @mass = mass + @number_of_moons = number_of_moons + end + + def print_out + puts "The planet #{@name} has a diameter of #{@diameter}, a mass of #{@mass}, and #{@number_of_moons} moons." + end +end diff --git a/solar-system.rb b/solar-system.rb new file mode 100644 index 00000000..65adf2c6 --- /dev/null +++ b/solar-system.rb @@ -0,0 +1,20 @@ +class SolarSystem + + attr_accessor :name, :diameter, :mass, :moons + + def initialize(solarsystemname, size) + @solarsystemname = solarsystemname + @size = size + @planets = [] + @array_of_planets = [] + end + + def add_new_planet(planet) + @planets.push(planet) + end + + def add_planets(planet_hash) + @planets.each do |plnt| + @array_of_planets.push(plnt) + end +end