Skip to content

Branches - Paige #31

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 1 commit into
base: master
Choose a base branch
from
Open

Branches - Paige #31

wants to merge 1 commit into from

Conversation

minipaige02
Copy link

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? I think my indentation, spacing, and readability was good, however, I struggled a little with creating variable names that were descriptive and understandable. Especially for my array where I stored the acceptable user inputs for the mathematical operations and the method I created for the display text of the available math options.
How did your code keep track of user input? I kept track of user input in four different variables, "operation" for the type of math the user wanted to do, "num_1" for the first number they input, "num_2" for the second number they input, and "result_integer" to store if they wanted the result as an integer or a float.
How did your code determine what operation to perform? It determined which operation to preform by taking the user input stored in "operation" and first checking it against an array where I stored all the acceptable input values. Then, I used the case/when syntax to determine the appropriate math function for the user's "operation" value.
What opportunities exist to create small methods for this project? In my code I utilized mainly pre-defined methods, like the case/when syntax, until, and if/else. After discussing with my fellow C12ers, I see that I could have also defined methods for each mathematical function, which would have broken down the printing of the result into smaller chunks.
In the next project, what would you change about your process? What would you keep doing? In the next project, I would try to utilize more defined methods with parameters and arguments. Also, I would want to explore storing the valid mathematical operation input into a hash instead of an array to see if there is a better way to use interpolation to calculate different results at the end of the code.

@minipaige02 minipaige02 changed the title Create calculator.rb Branches - Paige Aug 7, 2019
@tildeee
Copy link
Collaborator

tildeee commented Aug 9, 2019

Calculator

What We're Looking For

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

Well done on this project, Paige! Your code is well-organized, logical, and very readable. I like your solutions and approaches to the different problems in here.

If you had more time on this project, I would encourage you to find more opportunities to pull out methods. For example, your code for getting user input for the numbers is identical! I've also added a few other comments on minor suggestions in your code.

That being said, good work overall!

puts " Divide (/)"
puts " Exponent (^)"
puts " Modulo (%)"
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

I love that this display functionality is pulled into a method! Keep doing things like this! Also, I like my method names to usually be actions or action-like. Consider maybe changing this method name to display_maths_text or show_maths_text?

when "no", "n"
num_1 = num_1.to_f
num_2 = num_2.to_f
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is great!

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