-
Notifications
You must be signed in to change notification settings - Fork 44
Jackie - Solar System - Amper #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Solar SystemWhat We're Looking For
|
| planet_names << "#{i+1}. #{planet_name.name}" | ||
| i += 1 | ||
| end | ||
| puts planet_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again this should be a return and not a puts
|
|
||
| end | ||
|
|
||
| def add_planet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice method!
| # 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else selection == 3 is not really a thing. Do you mean elseif?
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initializemethod in your class?SolarSystemused anArrayvs aHash.