Ana Lisa Sutherland- Solar System- Octos C9#45
Ana Lisa Sutherland- Solar System- Octos C9#45The-Beez-Kneez wants to merge 2 commits intoAda-C9:masterfrom
Conversation
Solar SystemWhat We're Looking For
|
| @@ -0,0 +1,94 @@ | |||
| class Solar_S | |||
There was a problem hiding this comment.
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.
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.
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.
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.
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
initializemethod in your class?SolarSystemused anArrayvs aHash.