Skip to content

Conversation

@npeters5
Copy link

@npeters5 npeters5 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 stored user input into three different variables (num_1, num_2, and operator) using gets.chomp. I used a simple regex to test that user input included and integer, and I tested num_2 to make sure it was greater than zero (for the case of division by 0)
How did you determine what operation to perform? First I defined four different methods to compute addition, subtraction, multiplication, and division. Then I wrote a case statement that evaluated the user input for operator and then ran the appropriate method based on that operator. Within the case statement I converted the values stored in my num variables to floats, in case the answer contained a remainder.
Do you feel like you used consistent indentation throughout your code? Yes...? thanks to the new command+i shortcut.
If you had more time, what would you have added to or changed about the program? I plan to revisit this program later and tackle the optional enhancements!

@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. x

Great job! The calculator has all the expected functionality

We did not have a requirement that the second number must be greater than 0 ;) Only in the case of dividing by 0 should you handle it.

Your check for if num_2 is greater than 0 only happens once because you put it in an if instead of until. (For example, you could just type "-2" two times)

I actually don't know what Ruby's loop do does, but from what I've learned about it, I wouldn't recommend using it!

Looks good otherwise!

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