Skip to content

Conversation

@sharonkeikei
Copy link

Assignment Submission: Calculator

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

Reflection

Question Answer
What went well in your code style, such as indentation, spacing, variable names, readability, etc.? What was lacking? I am getting used to using snake case instead of camel case now! I added
How did your code keep track of user input? I saved the user input into variables.
How did your code determine what operation to perform? I have all the operation in hash, both symbols and with words and just pick from there, whatever that matches with the user input.
What opportunities exist to create small methods for this project? I created a method for checking whether the two numbers user input is valid.
In the next project, what would you change about your process? What would you keep doing? It still takes me some time to get started, I think I should just go ahead and try to see if it works rather than keep thinking of a perfect way to do it.


# loop thru the operator hash in order to show user what the choices are
i = 1
accepted_operation.each do |key, value|

Choose a reason for hiding this comment

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

clever use of a loop :)

return user_input.to_f
end

# ask user for the first number and check if it's valid

Choose a reason for hiding this comment

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

You've written almost exactly the same code here twice, to get the first number and the second number. Could you DRY that up by putting this logic in a method or loop?

i += 1
end

# ask user for a math operation

Choose a reason for hiding this comment

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

Consider putting the operation validation logic into it's own custom method.

@beccaelenzil
Copy link

Calculator

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly uses conditionals (if/else/elsif) ✔️
Correctly uses loops (while/until) ✔️
Correctly uses gets.chomp ✔️
Correctly uses variables ✔️
Correctly creates and uses custom methods ✔️

Functional Requirements

Functional Requirement yes/no
User can input two numbers and an operator and perform addition ✔️
User can input in two numbers and an operator and can perform subtraction ✔️
User gets feedback from the CLI when attempting to divide by zero, and the program does not give an error ✔️yay infinity!

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 3+ in Code Review && 2+ in Functional Requirements ✔️
Yellow (Approaches Standards) 2 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

Additional Feedback

Great work on this assignment! You have gracefully and cleverly handled invalid user input. I left a few comments for you to review, but it is clear that the learning goals for this project. Keep up the hard work!

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
Logical/Organized

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