Skip to content

Conversation

@avalliere
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? Initialize allowed me to define parameters in my class and then facilitated passing arguments to the parameters when I made each new instance of the class.
Describe an instance variable you used and what you used it for. Each instance of the Planet class was given many attributes through instance variables, such as diameter, order_from_sun, etc
Describe what the difference would be if your SolarSystem used an Array vs a Hash. My program has an array of hashes within SolarSystem. If I had made a nested hash, it might have been easier to search for specific planets in the code
Do you feel like you used consistent indentation throughout your code? Yes

@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 job overall!

class Planet
attr_accessor :name, :order_from_sun, :moon_count, :diameter, :day_length, :atmosphere_contents

def initialize(planets_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.


def add_planet(name, order_from_sun, moon_count, diameter, day_length, atmosphere_contents)
@planets.push(name, order_from_sun, moon_count, diameter, day_length, atmosphere_contents)
end

Choose a reason for hiding this comment

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

I'm not sure add_planet will quite work as you intend it to. Fortunately your program uses add_many, which works fine.

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