Skip to content

Conversation

@edeutschie
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What was the purpose of the initialize method in your class? In the case of the planet class, the purpose of the "initialize" method was to create planets and to assign specific attributes (name, color, number of moons, state, diameter).
Describe an instance variable you used and what you used it for. In my planet class, I used an instance variable to assign a color to each planet. In initialize method, I set @color = color, and then when each planet was created, the variable of a given color was assigned as the @color instance variable of that planet.
Describe what the difference would be if your SolarSystem used an Array vs a Hash. If my Solar System used an array (which it did), the planets (with all their attributes) would be stored as individual strings in an array. If my Solar System used a hash, I would have put each planet as it's own hash within a hash. Then each planets attributes would be stored as key value pairs (ex. key == "name", value == "Mercury").
Do you feel like you used consistent indentation throughout your code? yes - harder to keep it straight with this one.

@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

Good work overall!


def display_info
@my_solar_system.each do |planet|
puts "#{planet.name} is a #{planet.color} planet. It has #{planet.moons} moons, a diameter of #{planet.diameter} and exists in a #{planet.state} state."

Choose a reason for hiding this comment

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

Do you think you could call Planet#display_info here to avoid repeating logic?

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