Skip to content

Conversation

@canaanwest
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? it basically jumpstarted each object, creating necessary variables, like name, distance, and other details, depending on the class. It assigned each of these things values, based on the values given when Planet.new and SolarSystem.new was called.
Describe an instance variable you used and what you used it for. one of my instance variables was @distance_from_sun. It stored the distance in miles that each planet was from the center of that solar system. I used it several times to compare distances from the sun and determine how far apart planets were from each other (through the use of another method that called upon the instance variables for each planet object
Describe what the difference would be if your SolarSystem used an Array vs a Hash. my solar system did accept an array... of hashes. If I had tried to use an array of arrays (if my planets were arrays instead of hashes), it would be very difficult for me to access specific information--the use of hashes in this instance means that I could access specific traits by referencing the key that corresponded with the value I was interested in. If I had passed my solar system a hash instead of arrays, I would have had to use a hash of hashes, which would have worked, but might have been a little messier.
Do you feel like you used consistent indentation throughout your code? For the most part, I feel that my indentation was consistent on my own, but I used the shortcut to help me along with the remaining indentation for situations in which I began nesting loops.

@tildeee
Copy link

tildeee commented Aug 20, 2017

Solar System

What We're Looking For

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

end

def user_compare_planets(solarsystem, planet1, planet2)
planet1_position = solarsystem.find_planet(planet1)
Copy link

Choose a reason for hiding this comment

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

very small observation: your code doesn't check if the input name is a valid choice before you call solarsystem.find_planet :P

@tildeee
Copy link

tildeee commented Aug 20, 2017

Good code! You show a great understanding of how to pass objects/values as arguments to other methods, and using those arguments. The code is well done.

Regarding your answers to the comprehension questions: Your solar system does not take in an array of hashes, it (appropriately) takes in an array of Planets!

By the way, using the shortcut to align indentations in code is exactly what it's meant to be used for! :)

@@ -0,0 +1,198 @@
#PLANETS
class Planets
Copy link

Choose a reason for hiding this comment

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

small note: You may want to rename your classes so that they are always singular, as they represent a single Planet in this case.

puts planet_rotational_age(canaansworld, canaansworld.age, planet_choice)

elsif answer == "exit"
puts "Well, ttyl then, nerd"
Copy link

Choose a reason for hiding this comment

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

💥

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