Skip to content

Leaves - Alice#45

Open
sun-alice wants to merge 1 commit intoAda-C12:masterfrom
sun-alice:master
Open

Leaves - Alice#45
sun-alice wants to merge 1 commit intoAda-C12:masterfrom
sun-alice:master

Conversation

@sun-alice
Copy link

ride share

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What did your data structure look like at first? Did this structure evolve over time? Why? Originally, my data structure had a hash instead of an array under each driver. I had a key of “rides”, and the value was an array of all the individual rides. However, I later wondered why I had a key of “rides”, as it didn’t make much sense. The only elements that I wanted under each driver were the rides, so I removed that extra layer. Other than that, I had wanted to keep the data structure focused around the driver, as the questions being asked seemed to be mostly driver-centered.
What was your strategy for going through the data structure and gathering information? My strategy for going through the data structure was to iterate through each driver hash for each question. Because the data was organized by driver, I used .each loops (and .map when possible) to gather information about every driver. For questions such as who made the most money or who had the best rating, I was able to find those using a variable to track the most money/highest rating.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? An example of something that was necessary to store in a variable was the mostMoney and richestDriver variable. This was my way of tracking which driver made the most money. It was helpful because I was able to rewrite over the single variable easily if there was another driver that made more money, and it was also easy for me to access this data when I needed to report which driver made the most money.
What kinds of iteration did you use? Did you use .map? If so, when? If not, why, or when would be a good opportunity to use it? I used .each and .map. I used .map when I needed to pull out the ratings/costs of each drivers rides, and using .map made it easy to perform other actions on this data, such as add it all together.
Were some calculations easier than others? Why? I think that the calculations that required just information on a single driver were easier than others, because I didn’t have to combine data from separate elements of a hash/array. The bonus question was also challenging, as I kept trying to think of an enumerable to use, but ended up just going with an .each loop. Even after that, I was still having a hard time working with the syntax of nested hashes.

@sun-alice sun-alice changed the title Create rideshare.rb Leaves - Alice Aug 12, 2019
@dHelmgren
Copy link

Ride Share

What We're Looking For

Feature Feedback
Answers the comprehension questions yes
Readable code with consistent indentation and reasonable code style yes, remember, use snake_case
Outputs the correct number of rides each driver has given yes
Outputs the total amount of money each driver has made yes
Outputs the average rating for each driver yes
Outputs which driver made the most money yes
Outputs which driver has the highest average rating yes

end

puts "\nDriver #{richestDriver} made the most money: $#{mostMoney}."
puts "\nDriver #{nicestDriver} had the highest average rating: #{highestAverageRating}.\n\n"

Choose a reason for hiding this comment

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

I don't think I've ever seen someone call this 'nicest_driver', but I like it. :)

end

puts "\nTOTAL AMOUNT MADE PER DRIVER:"
mostMoney = 0

Choose a reason for hiding this comment

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

Remember, in Ruby we use snake_case for variables, so this should read most_money = 0.

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