From 7d4833598ad4c5dc1f7f3b0e388b28cbd149bc2b Mon Sep 17 00:00:00 2001 From: Sophia Donan Date: Sun, 27 Sep 2020 20:17:36 -0700 Subject: [PATCH 1/3] Wave 1 Complete --- main.rb | 0 planet.rb | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 main.rb create mode 100644 planet.rb diff --git a/main.rb b/main.rb new file mode 100644 index 00000000..e69de29b diff --git a/planet.rb b/planet.rb new file mode 100644 index 00000000..e69de29b From 2784605c09a3e3760686fa3d43bca9e7a62446df Mon Sep 17 00:00:00 2001 From: Sophia Donan Date: Sun, 27 Sep 2020 20:21:14 -0700 Subject: [PATCH 2/3] Wave 1 Complete --- .idea/.gitignore | 8 ++++++++ .idea/inspectionProfiles/Project_Default.xml | 6 ++++++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/solar-system.iml | 15 +++++++++++++++ .idea/vcs.xml | 6 ++++++ main.rb | 9 +++++++++ planet.rb | 16 ++++++++++++++++ 8 files changed, 72 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/solar-system.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..73f69e09 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..b0db9b0f --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..cd0b8b07 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..8489f57f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/solar-system.iml b/.idea/solar-system.iml new file mode 100644 index 00000000..6e7c09c2 --- /dev/null +++ b/.idea/solar-system.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/main.rb b/main.rb index e69de29b..7d651247 100644 --- a/main.rb +++ b/main.rb @@ -0,0 +1,9 @@ +require_relative 'planet' + +def main + + earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e8, 'Only planet known to support life') + puts earth.summary +end + +main diff --git a/planet.rb b/planet.rb index e69de29b..fb339fa5 100644 --- a/planet.rb +++ b/planet.rb @@ -0,0 +1,16 @@ + +attr_reader :name, :color, :mass_kg, :distance_from_sun_km, :fun_fact + +class Planet + def initialize(name, color, mass_kg, distance_from_sun_km, fun_fact) + @name = name + @color = color + @mass_kg = mass_kg + @distance_from_sun_km = distance_from_sun_km + @fun_fact = fun_fact + end + + def summary + return "#{name} is a #{color} planet in our solar system. It has a mass of #{mass_kg} and is #{distance_from_sun_km}km from the sun. A fun fact is #{fun_fact}." + end +end \ No newline at end of file From b15fc2942a566e23f94000ab906bda494a3c8221 Mon Sep 17 00:00:00 2001 From: Sophia Donan Date: Sun, 27 Sep 2020 22:07:11 -0700 Subject: [PATCH 3/3] Wave 2 in progress. stopping for timeboxing reasons --- main.rb | 9 +++++++++ planet.rb | 6 ++++-- solar_system.rb | 30 ++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 solar_system.rb diff --git a/main.rb b/main.rb index 7d651247..4c4d5fd9 100644 --- a/main.rb +++ b/main.rb @@ -1,9 +1,18 @@ require_relative 'planet' +require_relative 'solar_system' def main + solar_system = SolarSystem.new('Sol') earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e8, 'Only planet known to support life') puts earth.summary + + mars = Planet.new('Mars', 'red-orange', 6.39e23, 228526848, 'named after the roman god of war' ) + puts mars.summary + + list = solar_system.list_planets + puts list + end main diff --git a/planet.rb b/planet.rb index fb339fa5..58b38ba7 100644 --- a/planet.rb +++ b/planet.rb @@ -1,7 +1,9 @@ - -attr_reader :name, :color, :mass_kg, :distance_from_sun_km, :fun_fact +require_relative 'solar_system' class Planet + + attr_reader :name, :color, :mass_kg, :distance_from_sun_km, :fun_fact + def initialize(name, color, mass_kg, distance_from_sun_km, fun_fact) @name = name @color = color diff --git a/solar_system.rb b/solar_system.rb new file mode 100644 index 00000000..5ebc080f --- /dev/null +++ b/solar_system.rb @@ -0,0 +1,30 @@ +require_relative 'planet' + +class SolarSystem + attr_reader :star_name, :planets + + def initialize(star_name) + @star_name = star_name + @planets = [] + + end + + def add_planet(planet) + @planets << planet + end + + def list_planets + @more_planets = "Planets orbitiing #{star_name}:\n" + i = 0 + @planets.each do + planet_list = "#{i+1}. #{planets[i].name}\n" + @more_planets << planet_list + i += 1 + end + return @more_planets + end + + + + +end \ No newline at end of file