Skip to content

Leaves - Nicky#27

Open
njch5 wants to merge 2 commits intoAda-C12:masterfrom
njch5:master
Open

Leaves - Nicky#27
njch5 wants to merge 2 commits intoAda-C12:masterfrom
njch5:master

Conversation

@njch5
Copy link

@njch5 njch5 commented Aug 12, 2019

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? Initially, I only had one array of hashes with the array called "drivers_info" and the hashes nested in the array were each row's info from the rides.csv file (driver ID, date, cost, rider ID, and rating). I changed the data structure after I realized there were duplicate driver IDs and I thought it would be more practical to organize the data by driver ID then have a set of hashes nested within it with each day's information.
What was your strategy for going through the data structure and gathering information? On a piece of paper, I checked through my data structure to determine how to access the data I needed with the nested data structures. That way when I'm looping through the array and hashes, I am able to obtain the information with the iterator variables I name.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? I intialized two variables called "total_money" and "rating_total" set to 0 which would store total money each driver made during the week and their ratings, respectively, so that I could sum each driver's money and ratings during the week then push the value to empty hashes called "total_earned" and "each_avg_rating". The hashes would later help in printing how much each driver made and calculate average rating.
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_with_index in order to loop through each driver's information by their keys (driver IDs) and max_by for my "find_largest_value" method. Then I used the .map method to iterate through each driver's ride's information in order to sum their money and rating during the week.
Were some calculations easier than others? Why? Calculating the total rides was easy with the .length method. Total money and average rating was slightly more complicated since it involved initializing two empty hashes and summing each driver's money and ratings with the .map method within the .each_with_index loop.

@beccaelenzil
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
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 Nice work on this assignment. You code is clear and readable. You chose a data structure that made your computations efficient. See line comments for a comment about the use of .each_with_index vs .each.

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