Skip to content

Conversation

@npogodina
Copy link

Assignment Submission: Calculator

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions:

Reflection

Question Answer
What went well in your code style, such as indentation, spacing, variable names, readability, etc.? What was lacking? I was able to divide all code into methods. Variables have meaningful names and the overall indentation looks good. The basic requirements are met. I was especially happy that I figured out how to use regex for user input validation (numbers, both Integers and Floats). As for opportunities, the code lacks comments (I ran out of time) and does not distinguish between Integers and Floats (I am converting user input to Float right away).
How did your code keep track of user input? User input is being stored in three variables - one for operation type and two for numbers to do math on.
How did your code determine what operation to perform? My code has a case statement which performs a corresponding math operation based on user input.
What opportunities exist to create small methods for this project? The whole code is already split into methods, but it's possible to create even more granular ones - for example, a method for displaying the result of the calculation.
In the next project, what would you change about your process? What would you keep doing? I will start commenting my code right away so that I won't end up with a working solution without a single comment line. I am also considering using git for version control.

@beccaelenzil
Copy link

Calculator

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly uses conditionals (if/else/elsif) ✔️
Correctly uses loops (while/until) ✔️
Correctly uses gets.chomp ✔️
Correctly uses variables ✔️
Correctly creates and uses custom methods Wow, great job breaking up the problem using custom methods!

Functional Requirements

Functional Requirement yes/no
User can input two numbers and an operator and perform addition ✔️
User can input in two numbers and an operator and can perform subtraction ✔️
User gets feedback from the CLI when attempting to divide by zero, and the program does not give an error ✔️

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 3+ in Code Review && 2+ in Functional Requirements ✔️
Yellow (Approaches Standards) 2 in Code Review && 2+ in Functional Requirements
Red (Not at Standard) 0,1 in Code Review or 0,1 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging

Additional Feedback

Great work on this assignment. I've left a few comments for you to review. Overall, you did a great job breaking up the problem into subproblems using methods and gracefully handling invalid user input. It is clear that the learning goals for the project were met. Keep up the hard work!

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Logical/Organized

# \z end of the string to be matched
# / end of the regex

# def check_if_int(input)

Choose a reason for hiding this comment

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

Minor note: you should remove unused code from your finished project. Consider creating a file for yourself to store code logic that you'd like to save and might use in the future.

result = num1 - num2
when "multiply", "*"
result = num1 * num2
when "divide", "/"

Choose a reason for hiding this comment

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

Overall nice work handling division by 0. There's a very small bug introduced when you first try to divide by 0 as evidenced by this output. When you enter a new number, it still says 5.0 / 0.0 = ....

You can't devide by zero!
Enter a different number: ^[[A
Please, enter a valid number: 6.7

Here you go!
5.0 / 0.0 = 0.7462686567164178

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