Open
Conversation
…anets or exiting program
… details' from menu
…helper formatting method 'format_detail'
Solar SystemWhat We're Looking For
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initializemethod run? What does it do?initializemethod runs for the creation of objects of the classes SolarSystem and Planet. For SolarSystem it requires that a star_name is provided, and sets that value to the instance variable @star_name, and for Planet it requires all details of the planet to initialize the new object.Hashinstead of an instance of a class?Hashinstead of an instance of a class we would have to make the summary method somewhere separate, and it wouldn't be able to be part of the planet inherently, and would also look a lot messier in code since the string interpolation would be accessing nested hashes.SolarSystemclass used aHashinstead of anArrayto store the list of planets?Hashinstead of anArrayto store the list of planets, I think it would make sense to store the planet names as the keys and their information as the values, but if the planets are instances of classes it makes more sense to put it into an array since the attributes can easily be found with enumerable methods, which also work on hashes but there wouldn't be as much confusion from nesting.requirestatements? Which files neededrequires, and which did not? What is the pattern?require_relativefor the planet and solar system class files at the top of main.rb, the other files did not need anyrequirestatements since they contained only the templates for classes - their initial state and available behaviors, that are called from main.rb.