Skip to content

Conversation

@EricaJCasePhD
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What was the purpose of the initialize method in your class?

To define my instance variables, making them usable within class.
| Describe an instance variable you used and what you used it for. | |

I used gravity ratio to calculate how much someone would weigh on the planet.

| Describe what the difference would be if your SolarSystem used an Array vs a Hash. |
The hash would be a hash of hashes. Planet names would be keys and I would send values to the Planet class methods.
|
| Do you feel like you used consistent indentation throughout your code? | |
Yes

@droberts-sea
Copy link

Solar System

What We're Looking For

Feature Feedback
Created Custom Class with initialize method & instance variables. yes
Used an Array to store a list of planets in the SolarSystem class. yes
Readable code with consistent indentation. yes
Created a pull request with your name & a meaningful message. yes

class Planet
attr_reader :name ,:travel_time, :length_of_day, :gravity_ratio, :mean_temperature# degrees C

def initialize(hash)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job re-working Planet#initialize to take a hash.

end

def add_planet(planet)
if planet.is_a? (Array)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work supporting both an array and a single planet in the same method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants