Skip to content

Conversation

@marshi23
Copy link

@marshi23 marshi23 commented Aug 8, 2018

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program? I assigned the users' input to variables that I then perform checks on using iterators to make sure users' enter a valid input or get prompt to enter a new input.
How did you determine what operation to perform? The operation is determined by what the user inputs.
Do you feel like you used consistent indentation throughout your code? Yes
If you had more time, what would you have added to or changed about the program? I would allow room for the user to perform another calculation within a parenthesis.

@CheezItMan
Copy link

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. Check, although you have a bug in how you handle dividing by zero.
Readable code with consistent indentation. Check, see some notes on style
Summary Well done you hit all the major learning goals. Check for my notes on your bug. Nice work on the extras with exponents and modulus.

end

# methods used
def add(num1, num2)

Choose a reason for hiding this comment

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

This is more of a style thing. It's a little odd putting the method definitions here in the middle of the program flow. I suggest moving method definitions to the top of the file.

operation = gets.chop.downcase
end

# collects two numbers for calculation

Choose a reason for hiding this comment

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

Do you think this method block could be turned into a reusable method?

puts "#{value_1} * #{value_2} = #{solution}"

elsif operation == "/" || operation == "solution"
if value_1 == 0 || value_2 == 0

Choose a reason for hiding this comment

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

Dividing something by zero is not zero. It's undefined.

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