Skip to content

Leaves - Raisah #54

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Leaves - Raisah #54

wants to merge 2 commits into from

Conversation

raisahv
Copy link

@raisahv raisahv commented Aug 8, 2019

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What went well in your code style, such as indentation, spacing, variable names, readability, etc.? What was lacking? My code is clean and effective. It meets the required goals and is well commented. I think I could have improved my variable names and the format of my string vs integer validation. My VS Studio also un-indented my case-when statement, which made it look wrong in comparison to the case-when statement examples on GitHub.
How did your code keep track of user input? My code stores user input in specific variables. My code asks the user to re-enter information if they enter invalid inputs. When the user enters new input after a mistake, this new input replaces the old input and is stored as a variable.
How did your code determine what operation to perform? My code determined the operation to perform by using a case-when statement.
What opportunities exist to create small methods for this project? I had started by using methods for each operation (adding, subtracting, etc), but ended up removing these methods and incorporating the functions into my case-when statement to make my code less redundant.
In the next project, what would you change about your process? What would you keep doing? I would attempt to make this calculator flexible with floats. I think next time I would think about the project conceptually first and research any tools that I don't have (for this project, it would have meant researching regex). That way when I'm actually writing the code I know the tools that I have at my disposal.

Copy link

@beccaelenzil beccaelenzil left a comment

Choose a reason for hiding this comment

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

Great work. You code is clear and you make good use of new concepts (case/when, methods). The user experience if quite refined. Furthermore, your responses to the reflection questions are thorough and thoughtful. See the code review for a few minor suggestions.

oper = gets.chomp
end

# asks the user to enter two numbers, prints error if invalid input
Copy link

@beccaelenzil beccaelenzil Aug 9, 2019

Choose a reason for hiding this comment

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

You've written almost exactly the same code here twice, to get the first number and the second number. Could you DRY that up by putting this logic in a method or a loop?

while num2_test.to_s != num2
print "You entered an invalid number, please enter your second number again: "
num2 = gets.chomp
num2_test = num2.to_i

Choose a reason for hiding this comment

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

You noted this in your reflection, but you should convert to floats so that it handles float division correctly (5/6 should not equal 0)

@beccaelenzil
Copy link

Calculator

What We're Looking For

Feature Feedback
Readable code with consistent indentation yes
Practices using variables appropriately yes
Practices using conditionals appropriately yes
If any, practices iteration appropriately yes
If any, practices using custom methods appropriately yes
Takes in two numbers and an operator and can perform addition yes
Takes in two numbers and an operator and can perform subtraction yes
The program handles divide when attempting to divide by zero yes

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