-
Notifications
You must be signed in to change notification settings - Fork 48
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
Sockets - Erica #24
base: master
Are you sure you want to change the base?
Sockets - Erica #24
Conversation
… color to initialized variables in planet.rb
…create solar system instance and additional planets
…d fixed bugs in control loop in main
Good job overall - this submission is well-organized and clearly hits the learning goals. Keep up the hard work! |
solar_system = SolarSystem.new("Sol") | ||
mercury = Planet.new("Mercury", "dark grey", 3.285e23, 5.791e7, "Named for the messenger of the Roman gods due to its orbital speed") | ||
solar_system.add_planet(mercury) | ||
venus = Planet.new("Venus", "red-brown", 4.867e24, 1.082e8, "Both the morning star and the evening star") |
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.
You should wrap all this work in a main
method.
def user_adds_planet | ||
puts "Please complete the following information for the planet you would like added: \nName: " | ||
name = gets.chomp.capitalize | ||
puts "Color: " |
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.
I like that you've broken this out as a separate method. Since this method interacts with the user, it might fit better in main.rb
, possibly taking the solar system as an argument.
def distance_between_by_input | ||
puts "Please enter the two planets you would like to find the distance between:" | ||
print "Planet 1: " | ||
planet1 = self.find_planet_by_name(gets.chomp) |
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.
As above, it might make sense to split the user interaction pieces of this out into a separate method in main.rb
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initialize
method run? What does it do?Hash
instead of an instance of a class?SolarSystem
class used aHash
instead of anArray
to store the list of planets?require
statements? Which files neededrequire
s, and which did not? What is the pattern?