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

Create Ada-C14-Taylor #52

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

Conversation

TaylorMililani
Copy link

Hopefully I'm re-submitting this right? If the dates are still in this format: "2016,2,3" please let me know because I changed some things after submitting the first time and I want to make sure the right code is being saved.

Assignment Submission: Ride Share

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
What did your data structure look like at first? Did this structure evolve over time? Why? At first it was just an array of hashes, each hash being the data for each ride. It evolved into being an array of arrays of hashes, each subarray grouping together the hashes of ride data by driver.
What was your strategy for going through the data structure and gathering information? I accessed the subarrays with indices, accessed the hashes with indices and then accessed the specific pieces of data with hash keys.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? With a few of the methods I defined new arrays and then from those arrays I printed data for each driver
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 array.length.times
Were some calculations easier than others? Why? I had a bit of a tougher time with finding the max earnings and rating.

Hopefully I'm re-submitting this right? If the dates are still in this format: "2016,2,3" please let me know because I changed some things after submitting the first time and I want to make sure the right code is being saved.
Copy link

@kaidamasaki kaidamasaki left a comment

Choose a reason for hiding this comment

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

Not a big deal, but I think you missed the part of the instructions about putting your code in worksheet.rb (there were helpful comments there to make your life easier, but you got it done anyway, so good job!).

One thing I would like you to focus on going forward is getting a better handle on using enumerable methods. Specifically using each instead of doing an array.length.times and using more specialized methods like sum where appropriate. (See the comment I left as an example.)

You managed to get the job done but in the future I think you will find you can get things done more quickly and easily if you read up on some more of what Ruby has to offer. 😃

Ride Share

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly creates, reads, and modifies variables ✔️
Correctly creates and accesses arrays ✔️
Correctly creates and accesses hashes ✔️
Reasonably organizes large amounts of related data into nested arrays and hashes ✔️
Correctly iterates through a nested data structure using loops and/or Enumerable methods For many of the calculations you didn't iterate over the inner arrays, you just used repeated addition.
Reasonably organizes small pieces of code into methods, and calls/invokes those methods ✔️

Functional Requirements

Functional Requirement yes/no
To the terminal, the program outputs the correct number of rides each driver has given ✔️
... outputs the total amount of money each driver has made ✔️
... outputs the average rating for each driver ✔️
... outputs which driver made the most money ✔️
... outputs which driver has the highest average rating ✔️

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 4+ in Code Review && 3+ in Functional Requirements ✔️
Yellow (Approaches Standards) 2-3 in Code Review && 2+ in Functional Requirements
Red (Not at Standard) 0,1 in Code Review or 0,1 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Concise
Logical/Organized

i = 0
array.length.times do
puts "Driver DR000#{i + 1} gave #{array[i].length} rides"
i += 1

Choose a reason for hiding this comment

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

Funky indentation:

Suggested change
i += 1
i += 1

Comment on lines +84 to +89
if array[i].length == 3
puts "Driver DR000#{i +1} made $#{array[i][0][:cost] + array[i][1][:cost] + array[i][2][:cost]}"
else
puts "Driver DR000#{i + 1} made $#{array[i][0][:cost] + array[i][1][:cost]}"
end
i += 1

Choose a reason for hiding this comment

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

You can clean this up using sum on the inner array:

Suggested change
if array[i].length == 3
puts "Driver DR000#{i +1} made $#{array[i][0][:cost] + array[i][1][:cost] + array[i][2][:cost]}"
else
puts "Driver DR000#{i + 1} made $#{array[i][0][:cost] + array[i][1][:cost]}"
end
i += 1
puts "Driver DR000#{i +1} made $#{array[i].sum {|ride| ride[:cost] }}"
i += 1

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