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

Victoria Sawchuk -- Carets #25

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

Conversation

vsawchuk
Copy link

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program. I stored user input in variables (action, input_num1, and input_num2)
How did you determine what operation to perform? I used a case statement based on the value of the action variable (user input)
How did you make sure your program behaved correctly? I continued to test for edge cases. I found a begin...rescue...end block that allowed me to avoid errors caused by the eval method.
Do you feel like you used consistent indentation throughout your code? I think I did, but I'm sure I made some mistakes since I finished this on a redeye flight :)
If you had more time, what would you have added to or changed about the program? I was attempting to add to the eval_test method so that parenthetical expressions would have numbers evaluated as floats, but just didn't have time to figure out the correct way to split the string into an array as I had planned. The issue is that currently all acceptable parenthetical expressions will be evaluated as input by the user, so the user could type in (5/4) and get 1 instead of 1.25.

@vsawchuk vsawchuk changed the title Create Calculator.rb Victoria Sawchuk -- Carets Aug 12, 2017
@vsawchuk
Copy link
Author

Renamed to include my name in the pull request title.

@CheezItMan
Copy link

CheezItMan commented Aug 13, 2017

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. Check
Baseline
Readable code with consistent indentation. Check
Extras
Summary Nice work, You found the eval method and it works well here, even with parentheses. Just be careful that eval evaluates the string as Ruby code, and it's a bit of a security vulnerability because ANY You can read up on that [here](http://archive.oreilly.com/pub/a/ruby/excerpts/ruby-best-practices/worst-practices.html#The Evils of eval()). Nicely done!

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