Skip to content

Conversation

@Allison-Northrop
Copy link

@Allison-Northrop Allison-Northrop 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? To give the instance variables an initial value
Describe an instance variable you used and what you used it for. One instance variable I used was @name. This was used to identify a planet's name.
Describe what the difference would be if your SolarSystem used an Array vs a Hash. The difference would be that an array wouldn't have keys tied to information where as a hash would have keys tied to it. So, there's a method that creates an array of planet information. This turns out to be an array of hashes, the planet info in a hash, and each planet part of an array.
Do you feel like you used consistent indentation throughout your code? Yes. it was particularly important in distinguishing how many "ends" are needed within a class and within a method.

@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

Great work overall!

end

def planet_paragraph
return "The planet #{name} is a #{color} planet with #{moons} moon(s). #{name} has a #{mass} mass and is #{diameter}" \

Choose a reason for hiding this comment

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

I like that you return a value here rather than puts-ing it. This will make the method more useful from other parts of your code.

class Planet
attr_accessor :name, :color, :moons, :mass, :diameter, :solar_rotation, :distance_from_sun

def initialize(planet_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