Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaves - Morgan #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

morganschuler
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? My data structure has always looked the same because I wanted to make sure it was driver-centered. Seeing that the questions asked for data about each driver, I found that it was easiest to structure it that way from the beginning. The structure evolved over time when I added hashes to determine who was the highest earner and who had the highest rating. After going over the dessert example in class, I realized that they could be useful to keep track of which driver was the highest in each respective category.
What was your strategy for going through the data structure and gathering information? I found that it was easier to break it up based on each question. At first, I iterated through the loop and had my code count each hash within each driver's array to determine the number of rides, which was fairly simple based on how I had structured my data. I found it a lot more complicated when I need to sum the costs or get the average rating for each driver. For this, I utilized symbols as a way of calling the information I needed to determine the correct outputs.
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 I needed to store in a variable was the summed earnings for each driver. This was useful later when I created a loop that compared this value to the value of the driver who earned the most.
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 .map in my methods to create arrays connected to a specific key ([:cost] and [:rating]). I also used .each to iterate through my data when I was counting the number of rides each driver had done.
Were some calculations easier than others? Why? Yes, I found that finding the number of rides was the easiest because I was just iterating through the array and essentially counting the number of hashes. It became more complicated when I need to find information within the array, and then go one step further with that, such as summing or finding the average.

@beccaelenzil
Copy link

beccaelenzil commented Aug 14, 2019

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 yes
Overall Great work! Your code is very clear and you make code use of methods to encapsulate functionality. You met the learning goals around working with enumerables and complex data structures.


puts ""

puts "Driver #{highest_total_earnings[:driver]} earned the most with a total of $#{sprintf('%.2f', highest_total_earnings[:earnings])}."

Choose a reason for hiding this comment

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

You can use a \n to puts an empty line

puts "\nDriver #{highest_total_earnings[:driver]} earned the most with a total of $#{sprintf('%.2f', highest_total_earnings[:earnings])}."

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