Open
Conversation
Solar SystemWhat We're Looking For
|
CheezItMan
reviewed
Feb 13, 2018
| planet_names << "#{i+1}. #{planet_name.name}" | ||
| i += 1 | ||
| end | ||
| puts planet_names |
There was a problem hiding this comment.
This method should return planet_names not puts!
That way SolarSystem just returns the information the user decides what to do with it.
| @mean_temp = input_mean_temp | ||
| end | ||
|
|
||
| attr_reader :name, :diameter, :distance_from_sun, :orbit_period, :moons, :mean_temp |
There was a problem hiding this comment.
This should for readability be up at the top above initialize
| attr_reader :name, :diameter, :distance_from_sun, :orbit_period, :moons, :mean_temp | ||
|
|
||
| def planet_summary | ||
| puts "\nHere are some fun facts about #{@name}: |
There was a problem hiding this comment.
Again this should be a return and not a puts
|
|
||
| end | ||
|
|
||
| def add_planet |
There was a problem hiding this comment.
The act of adding a planet to the list should be in SolarSystem because we want the SolarSystem to be responsible for what planets are in the list. Having a method outside the class to create the planet and do the prompting is good however.
| print "Enter the number of your choice: " | ||
|
|
||
| # User will get error if they don't enter a valid choice (1,2 or 3) | ||
| selection = valid(3) |
| # User prompted to enter new planet information | ||
| new_planet = add_planet | ||
| objects_of_planets_class.push(new_planet) | ||
| else selection == 3 |
There was a problem hiding this comment.
The else selection == 3 is not really a thing. Do you mean elseif?
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 in your class?SolarSystemused anArrayvs aHash.