Skip to content

Conversation

@J-C-L
Copy link

@J-C-L J-C-L commented Feb 15, 2017

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What was the purpose of the initialize method in your class? The main purpose of the 'initialize' method was to set up instance variables for the class. These variables are then automatically instantiated for each object of the given class when the object is created by the 'new' method. In addition to setting up instance variables, initialize also holds any other actions that need to happen at the time of an object's creation.
Describe an instance variable you used and what you used it for. I used the instance variable @mass in the Planet class. This holds the mass of any given planet.
Describe what the difference would be if your SolarSystem used an Array vs a Hash. My Solar System class used an array to store the set of planets belonging to any particular solar system. This allowed the planets to be stored in an ordered list, indexed by integers starting at 0. Information about each planet was stored separately, through instance variables in the Planet class. Another set up might have been to store the planets for a given solar system in a hash, where the keys were the planets, and the values were hashes giving the different pieces of information about the planets. In this case, there would be no ordering of the planets.
Do you feel like you used consistent indentation throughout your code? Yes, with the help of atom.

@droberts-sea
Copy link

Solar System

What We're Looking For

Feature Feedback
Created Custom Class with initialize method & instance variables. Yes
Used an Array to store a list of planets in the SolarSystem class. Yes
Readable code with consistent indentation. Yes
Created a pull request with your name & a meaningful message. Yes

Excellent work on the optionals!

class Planet
attr_accessor :name, :mass, :number_of_moons, :length_of_day, :distance_from_sun, :mean_temperature, :solar_revolution_rate

def initialize (address_hash)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job re-working Planet#initialize to take a hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants