Skip to content

Branches - Linnea#26

Open
llinneaa wants to merge 2 commits into
Ada-C12:masterfrom
llinneaa:master
Open

Branches - Linnea#26
llinneaa wants to merge 2 commits into
Ada-C12:masterfrom
llinneaa:master

Conversation

@llinneaa

Copy link
Copy Markdown

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? My first data structure was a hash stored in the variable 'drivers' with the four driver ids as the keys and a hash containing all the trip information as the values. The hash containing trip info contained the name of the data point as the key and an array containing data from each trip (in order) as the value. I chose not to use this structure because it was easier to access and iterate through an array.
What was your strategy for going through the data structure and gathering information? From the questions asked it was apparent that the program needed to be driver-centric, so I took that approach when I was building my data structure and strategizing how to best gather information.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? I chose to store the total earnings for each driver in a variable called "earnings," which I then added to the hash containing the trip information for each driver. I needed to calculate the highest earner, so storing this variable and key/value pair was helpful when I needed to access the 'earnings' information later in the program.
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' iterations for my program and did not use .map. I chose not to use the .map method because there is no instance in my code where I'm transforming each element in a data structure - I'm simply iterating over each element or adding a new element.
Were some calculations easier than others? Why? The first three calculations were easier because they were simple calculations and involved far fewer steps than the last two. For calculating the highest earner, I needed to assign and reassign variables within the method and it was confusing to track at times.

@jmaddox19

Copy link
Copy Markdown

Ride Share

What We're Looking For

Feature Feedback
Answers the comprehension questions X
Readable code with consistent indentation and reasonable code style Mostly true! Just a few callouts below
Outputs the correct number of rides each driver has given X
Outputs the total amount of money each driver has made X
Outputs the average rating for each driver X
Outputs which driver made the most money X
Outputs which driver has the highest average rating X

Good job! I love that you split each question into it's own method.

A few things I noticed that I think it would be worth spending a little bit of time looking more into or talking with Dee, Kaida, or myself about:

  • You're using each_with_index in several places where most people would find it easier to just use each
  • You're naming the iteratee different things that don't accurately reflect what it is (ie. rides, costs, ratings, when in reality in each case a more accurate name would be driver)
  • You're returning and reassigning trip_data unnecessarily. In each case, trip_data isn't being changed in any way, which is great! It totally makes sense that you aren't changing it! But because of that, it isn't necessary for the methods to return anything nor is it necessary for you to continuously reassign trip_data at the bottom of the program.

It also may be worth practicing using more with the built-in methods for Arrays, Hashes, and Enumerables in the future. Everything you did is spot on! You basically wrote your own versions of sum and avg methods which is great to be able to do - just wouldn't want you to continue to do all that work moving forward.

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