Skip to content

Conversation

@SelamawitA
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?
The initialize method is meant to ensure a user will pass in required data before instantiating an object, this reduces future run-time errors. In the SolarSystem class, the SolarSystem age and an array are required for the object to be used.
Describe an instance variable you used and what you used it for.
@planets is an instance variable that stores an array of planet objects. It was used in multiple methods in the Solar System class for displaying planet information and being able to add a planet into a single data structure.
Describe what the difference would be if your SolarSystem used an Array vs a Hash.
The loop structure in the print_list method would need to be modified depending on the data structure and the loop would execute differently in both cases. With an array it would be by index, with a loop it would be by symbol.
Do you feel like you used consistent formatting throughout your code?
I think so.

@tildeee
Copy link

tildeee commented Feb 14, 2018

Solar System

What We're Looking For

Feature Feedback
Baseline
Readable code with consistent indentation. x
Primary Requirements
Created Custom Solar System Class with initialize, add planet & list planets methods, without using puts. x
Planet Class Created x
Created a collection of Planet objects as an instance variable in SolarSystem. x
Accessor methods created x
Method created to return the Planet's attributes and not use puts x
Created a user interface to interact with the SolarSystem including adding a planet and viewing a planet's details x
Additional Notes

Fantastic project!

This project accomplishes what we expected and runs as expected!

You did a great job of defining SolarSystem and Planet. The different classes track their own state and behavior.

I'm adding a few suggestions of how you might make the code better but good job overall



class Planet
attr_reader:name, :radius_mi, :distance_frm_sun, :num_moons, :num_suns, :year_in_days
Copy link

@tildeee tildeee Feb 14, 2018

Choose a reason for hiding this comment

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

A small thing, but important. This syntax is wrong because you need a space between attr_reader and :name so it should be:

attr_reader :name, :radius_mi, :distance_frm_sun, :num_moons, :num_suns, :year_in_days

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants