Conversation
still working on wave 3
wave 3 list planets, planet details working.
wave 3
Solar SystemWhat We're Looking For
Good job overall. Your code is clean and well-organized, and you definitely hit the project requirements. However, I am concerned that you may have missed learning goals around working with git, and around using helper methods with classes. Please review these two topics, and feel free to reach out if you have questions. |
| def add_new_planet | ||
| puts "What is the name of the planet?" | ||
| name = gets.chomp.capitalize | ||
| puts "What color is the planet?" |
There was a problem hiding this comment.
I like that you broke this out into a separate method - good organization!
| elsif input == "add planet" | ||
| planet_new = add_new_planet | ||
| solar_system.add_planet(add_new_planet) | ||
| else |
There was a problem hiding this comment.
On line 30 you call add_new_planet and assign it to the planet_new variable. Then on line 31, instead of using planet_new, you call add_new_planet again! That means the user has to enter all this info twice.
There was a problem hiding this comment.
THANK YOU for pointing that out. that was driving me bananas i couldnt figure out why it asked twice.
|
|
||
| def name | ||
| return @name | ||
| end |
There was a problem hiding this comment.
You should use the helper methods (attr_reader, attr_writer, attr_accessor) to generate these getter and setter methods.
| def find_planet_by_name(planet_name) | ||
| @planets.each do |planet| | ||
| if planet_name.upcase == planet.name.upcase | ||
| return planet |
There was a problem hiding this comment.
Is there an enumerable method you could use for this?
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initializemethod run? What does it do?Hashinstead of an instance of a class?SolarSystemclass used aHashinstead of anArrayto store the list of planets?requirestatements? Which files neededrequires, and which did not? What is the pattern?