Skip to content

Conversation

@kangazoom
Copy link

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program? I stored the user inputs as variables (a total of three: operation, number 1, number 2)
How did you determine what operation to perform? I used an if/else statement to check against the user input and valid operators
Do you feel like you used consistent indentation throughout your code? Hopefully, yes!
If you had more time, what would you have added to or changed about the program? I would have changed the conditionals used with the while loop in the operator validation method to a list.include? to minimize repetition

@droberts-sea
Copy link

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. yes
Readable code with consistent indentation. yes

Great job overall! This code works well, and I really like the way you use methods to break up your code - this makes it much easier to read than it would be otherwise. You also make good use of whitespace to separate different ideas. Keep up the hard work!

def checks_input_operator(operator_choice)
while operator_choice != "ADD" && operator_choice != "+" && operator_choice != "SUBTRACT" && operator_choice != "-" && operator_choice != "MULTIPLY" && operator_choice != "*" && operator_choice != "DIVIDE" && operator_choice != "/" && operator_choice != "MODULO" && operator_choice != "%" && operator_choice != "EXPONENT" && operator_choice != "^"
puts inserts_blank_line()
puts "Oops! Your entry was invalid. Please try again."

Choose a reason for hiding this comment

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

I like that you've broken all of these out into their own methods - that makes the driver code below very easy to read.

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