Skip to content

Conversation

@criacuervos
Copy link

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What went well in your code style, such as indentation, spacing, variable names, readability, etc.? What was lacking? I was able to name and keep track of my variables with ease. What might've been lacking is how I dealt with integers/floats, in the if/elsif statements there is likely a DRYer way to convert user input into a number.
How did your code keep track of user input? User input was stored in a descriptive variable.
How did your code determine what operation to perform? If an operator was entered by the user, then the proper mathematical operation was executed.
What opportunities exist to create small methods for this project? You could create a method to validate numeric input is received from the user, rather than gibberish.
In the next project, what would you change about your process? What would you keep doing? I would keep using an array to organize the operators probably. But I would use methods to take in user input and validate that the user input is a numerical value with rescue false.

@criacuervos criacuervos changed the title Calculator Assignment Submission Branchess VI Aug 7, 2019
@tildeee
Copy link
Collaborator

tildeee commented Aug 9, 2019

Calculator

What We're Looking For

Feature Feedback
Readable code with consistent indentation x
Practices using variables appropriately x
Practices using conditionals appropriately x
If any, practices iteration appropriately x
If any, practices using custom methods appropriately this submission didn't have any methods!
Takes in two numbers and an operator and can perform addition x
Takes in two numbers and an operator and can perform subtraction x
The program handles divide when attempting to divide by zero x

Well done on this project, Vi!

Your code is organized, logical, and readable. It practices a lot of the ideal things in code style; it is concise, not too dense, while not being verbose. Genuinely, your code is nice to look at.

Just like you said, turning in the user input functionality into a method would be the next step from here. Also, refactoring the section that checks operator == "+" || operator == "add" etc into a case/when statement may also be a good next step.

Otherwise, overall, this code looks great. Well done!

end

#for dealing with divide by zero, check if the second number is zero if the operator is division.
while (operator == "/" || operator == "divide") && number2 == "0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is such a clean way to solve the divide by zero problem, well done :D


#for dealing with divide by zero, check if the second number is zero if the operator is division.
while (operator == "/" || operator == "divide") && number2 == "0"
puts "ya can't divide by 0 dingus, try again"
Copy link
Collaborator

Choose a reason for hiding this comment

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

ya dingus!

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