Skip to content

Conversation

steffnay
Copy link

@steffnay steffnay commented Feb 8, 2018

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program? I used gets.chomp.upcase to store user input so that it was uniform for use in the calculator operations
How did you determine what operation to perform? I used an if statement that accepted both operation names and symbols.
Do you feel like you used consistent indentation throughout your code? No. I just updated my Atom setting to auto-indent to help me with this.
If you had more time, what would you have added to or changed about the program? I would have added the ability for my program to determine whether to return an integer or a float because that seems a little tricky to me right now.

@tildeee
Copy link

tildeee commented Feb 12, 2018

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. x
Readable code with consistent indentation. only two hiccups for indentation, otherwise great

Lovely calculator! Functions wonderfully

Your custom methods (add, subtract, etc) are great!

Your loops are great! They work perfectly for waiting for correct user input, and ESPECIALLY the times loop in the case of operation being exponent.

I'm surprised you went with if/elsif/elsif conditionals instead of a case statement, but truthfully it all works out and is just as effective :)

I think overall, good, clean, functional code

I'm commenting on two places in the code where the indentation was off just for your information

Also, you didn't handle dividing by zero

until possible_operations.include?(operation)
puts "That is an invalid operation. Try again"
operation = gets.chomp.upcase
end
Copy link

Choose a reason for hiding this comment

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

indentation is a lil off here

while num_one.to_i.to_s != num_one
puts "That is not a valid number. Please try again."
num_one = gets.chomp
end
Copy link

Choose a reason for hiding this comment

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

indentation is a lil off here too

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