Skip to content

Conversation

@edeutschie
Copy link

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program? I gathered user input with gets.chomp and then stored the input by assigning it to one of three variables (operation, num_one, and num_two).
How did you determine what operation to perform? I saved the potential operators as strings in an array called operators. Then I used an if/elsif conditional statement with boolean expressions to determine which operator the user had entered.
Do you feel like you used consistent indentation throughout your code? Yes. And used the "line indent" to double check.
If you had more time, what would you have added to or changed about the program? If I had more time, I would try and redo the conditional statement using the case/when syntax. And I would have gone into optional enhancements like printing out the formula in addition to the result and adding support for computing exponents.

@edeutschie
Copy link
Author

I realized after submitting that my solution to dealing with dividing with 0, only gives the correct response for when 0 is the first number. Whether the math is 0 / 5 or 5 / 0 my calculator says the answer is 0. When the second number is 0 (ex 5 / 0), I should have my calculator give the user an error message.

@kariabancroft
Copy link

Calculator

What We're Looking For

Feature Feedback                                                                              
Takes in two numbers and an operator and performs the mathematical operation. Well Done
Baseline
Readable code with consistent indentation. Well Done
Extras
Functionality It doesn't recognize decimal numbers as numbers, I can't put in 2.1
Methods When you start to see chunks of code repeated, like Lines 40-46 and and 50-56, it's a good idea to put it in a method instead.

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