Skip to content

Conversation

@faezeh-ashtiani
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? my code has good spacing and variable names, but I would like to learn how can I make it more readable
How did your code keep track of user input? I asked the user for providing the operation they would like and two numbers. for the operation, I defined and array that their input needed to be one of those, otherwise they had to provide input again, which I then stored in a variable. for the numbers I defined a method to test if the input is a number. if the inout passed the method, I stored it in a variable.
How did your code determine what operation to perform? The user provided what operation they wanted to have, then I used a case conditional to perform the operation
What opportunities exist to create small methods for this project? One is the method that tests user input if it is a number, another opportunity can be where we ask user to let us know what operation they want from the calculator, that can also be tested in a method instead of the until loop in my code
In the next project, what would you change about your process? What would you keep doing? I would like to become more conscious about what chunks of code I can make more concise or group together

@CheezItMan
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 ✔️, You have one really nice custom method here.

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 ⚠, sort of, it simply outputs infinity

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 3+ in Code Review && 2+ in Functional Requirements ✔️

Code Style Bonus Awards

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

Quality Yes?
Perfect Indentation ⚠ Almost, just some indentation under the case, but it's really good.
Elegant/Clever ✅, I like the custom method.
Descriptive/Readable
Concise
Logical/Organized

Summary

Well done, you hit the learning goals here. Excellent work!

Comment on lines +30 to +34
class Object
def is_number?
to_f.to_s == to_s || to_i.to_s == to_s
end
end

Choose a reason for hiding this comment

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

Clever. Did you find this on Stack Overflow or someplace. It's best to leave a comment with a link to where you find something like this.

Copy link
Author

Choose a reason for hiding this comment

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

I had found it from stack overflow when I was writing code for the technical challenge. I will comment the source from now on when I find something. thank you for reminding me.

num_2 = num_2_str.to_f

case command
when "add", "+"

Choose a reason for hiding this comment

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

Really the when lines should be indented under the case.

Copy link
Author

Choose a reason for hiding this comment

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

Really the when lines should be indented under the case.

Chris, it seems that I have installed an add on on VS code that is supposed to fix all the indentations when I save the file, but in this case it un-indents the "when" blocks. Is there a way I can fix this?

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