-
Notifications
You must be signed in to change notification settings - Fork 48
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
Create Stephanie_Ride_Share.rb #27
base: master
Are you sure you want to change the base?
Conversation
Ride ShareMajor Learning Goals/Code Review
Functional Requirements
Overall Feedback
Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
SummaryNice work, you hit all the learning goals here. Well done. |
drivers.each { |driver, drive| | ||
drive.each { |drives| | ||
driver_pay += drives[:cost] | ||
driver_rating += drives[:rating] | ||
} | ||
if driver_pay > max_pay | ||
max_pay = driver_pay | ||
max_driver = driver | ||
end | ||
driver_rating = (driver_rating / drive.length).round(2) | ||
if driver_rating > best_rating | ||
best_driver = driver | ||
best_rating = driver_rating | ||
end | ||
puts "Driver #{driver} gave #{drive.length} rides and made a total of $#{driver_pay}.00. | ||
Their average rating is #{driver_rating}" | ||
driver_pay = 0 | ||
driver_rating = 0.0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works and it's pretty readable, but I suggest looking at breaking each step into a method for practice breaking code into components.
It's also pretty dense.
Assignment Submission: Ride Share
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
.map
? If so, when? If not, why, or when would be a good opportunity to use it?