Skip to content

Conversation

@cojenco
Copy link

@cojenco cojenco commented Feb 5, 2020

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? Checked indentations and tried to create meaningful variable names. After submission I noticed that I lacked many comments to assist readability.
How did your code keep track of user input? Prompted user to input and stored getschomp into variables
How did your code determine what operation to perform? Created a method to determine what operator to perform. Along with a loop to check whether or not the operator chosen was valid. Only until a valid operator was chosen, then will proceed to next step.
What opportunities exist to create small methods for this project? I would also want to create a method to validate the number instead of current code.
In the next project, what would you change about your process? What would you keep doing? To think more holistically and in a bigger picture in terms of flow. I had to revise a few times to improve the flow and efficiency.

@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 ✔️, nice Calculator method and operator_choice

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 ✔️

Code Style Bonus Awards

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

Quality Yes?
Perfect Indentation ⚠ some indentation issues here.
Descriptive/Readable
Concise
Logical/Organized ⚠ I suggest putting the methods up at the top and leaving the main code at the bottom so the method bodies don't break up the flow of the program.

Summary

Nice work, you hit all the learning goals here. Well done.

# method defining which operator user chooses
def operatorchoice(operator)
case operator
when "add", "+", "addition", "adding", "add(+)"

Choose a reason for hiding this comment

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

You should indent the when blocks over case.

Comment on lines +35 to +41
ans1 = gets.chomp
num1 = ans1.to_f
until ans1.to_i.to_s == ans1 || ans1.to_f.to_s == ans1
puts "Please re-enter number 1: "
ans1 = gets.chomp
num1 = ans1.to_f
end

Choose a reason for hiding this comment

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

Why is this indented?

@@ -0,0 +1,66 @@
# method defining which operator user chooses
def operatorchoice(operator)

Choose a reason for hiding this comment

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

Suggested rename

Suggested change
def operatorchoice(operator)
def operator_choice(operator)

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