Skip to content

Conversation

@marikoja
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? The initialize checks for the required inputs or sets the default inputs
Describe an instance variable you used and what you used it for. I used instance variables for each of the planet characteristics so that I could call them at different points within a given instance.
Describe what the difference would be if your SolarSystem used an Array vs a Hash. with an array I would not have been able to use keys and values for planet details.
Do you feel like you used consistent formatting throughout your code? I feel medium for consistency.

@tildeee
Copy link

tildeee commented Feb 14, 2018

Solar System

What We're Looking For

Feature Feedback
Baseline
Readable code with consistent indentation. x
Primary Requirements
Created Custom Solar System Class with initialize, add planet & list planets methods, without using puts. didn't use SolarSystem's add planet method
Planet Class Created x
Created a collection of Planet objects as an instance variable in SolarSystem. x
Accessor methods created x
Method created to return the Planet's attributes and not use puts x
Created a user interface to interact with the SolarSystem including adding a planet and viewing a planet's details x
Additional Notes

You need to fill out the comprehension question answers when you make a pull request

Good job on this project, it has everything we expected and runs as expected

Good job making and using the Planet and SolarSystem class.

You make an instance of SolarSystem named outer_space. You use SolarSystem's planet_list method with outer_space.planet_list. However, in order to add a new planet, you just modify the planets array-- it would be best if you made a method in SolarSystem class to add the planet. I'll add a small comment on the code about this!

This is a small bug, but if I type "explore" and then put in ANY number, there are some... unexpected consequences. I can type in "-1" or "0" or "234234". (I see that you have a comment that marks that as a TODO)

This is just a small observation, but your data you have for Jupiter, Mars, and Venus do not set an initial value @distance_from_sun so they always print out empty.

Also, I like the interaction "explore"

Overall good work


# TO DO: Add a check to ensure they've supplied a valid number

puts planets[gets.chomp.to_i - 1].all_facts
Copy link

Choose a reason for hiding this comment

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

the value of planets is the same as outer_space.planets. It would be better if you used that array instead, so it was outer_space.planets[gets.chomp.to_i - 1].all_facts

print "How far away from the sun is the planet? "
new_user_planet[:distance_from_sun] = gets.chomp.to_s

planets << Planet.new(new_user_planet)
Copy link

Choose a reason for hiding this comment

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

I mentioned this in my review but I think it'd be great if SolarSystem had this method:

class SolarSystem
...
def add_planet( new_planet )
  @planets << new_planet
end

and this line was instead

outer_space.add_planet( Planet.new(new_user_planet) )

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants