-
Notifications
You must be signed in to change notification settings - Fork 45
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
Ana Lisa Sutherland- Solar System- Octos C9 #45
base: master
Are you sure you want to change the base?
Conversation
Solar SystemWhat We're Looking For
|
@@ -0,0 +1,94 @@ | |||
class Solar_S |
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.
In general don't use underscore (_) in Class names. Instead naming this class SolarSystem
would be more appropriate.
# adds the new planet created by user to the whole solar system array | ||
def planet_bio | ||
planet_sum = [] | ||
planet_sum << "Name:#{name}\nColor:#{color}\nOrder In Solar System:#{order}\nYear Length:#{year_length}\nDistance From The Sun:#{@distance_from_the_sun}" |
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.
Why is planet_sum
an array? Why not make it just a String
? I don't think you gain anything making it an array.
Planet.new("Pluto","Grey","9th","90,500 Earth days","7.38 BM") | ||
] | ||
my_universe = Solar_S.new(milky_way) | ||
|
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'd put this in some kind of loop so I could see or add multiple planets.
|
||
if welcome_choice == "view" | ||
puts "Good choice, let me show you our planets" | ||
puts my_universe.summary |
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.
If the Planet name includes a number, it would be good to make sure that number works. Otherwise it's counterintuitive.
|
||
class Planet | ||
## Create reader methods to give a user access to read the instance variables. | ||
attr_accessor :name, :color, :order, :year_length, :distance_from_the_sun |
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.
Why make these attr_accessor
unless you specifically want to give users the ability to directly change the attributes using attr_reader
would be more appropriate.
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initialize
method in your class?SolarSystem
used anArray
vs aHash
.