Skip to content

Conversation

@mheshmati-tech
Copy link

@mheshmati-tech mheshmati-tech 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? The style and indentation is according to the proper format, variable names are self explanatory and the overall code is readable considering comments were used throughout the code for in depth explanation. I didn't do any of the enhancements however so the codes lacks some of the more intricate design that could accept more input from the user.

| How did your code keep track of user input? | I set them equal to variable num_1, command, and num_2

| How did your code determine what operation to perform? | I wrote a method for each command in the beginning and then called for the methods later using case/when operation to evaluate the users input. |

| What opportunities exist to create small methods for this project? | some of the opportunities included the actual calculation for each operation which I already did, in addition method could have been used for the verification of the users input. |

| In the next project, what would you change about your process? What would you keep doing? | I would keep pseudo code/commenting to have a general idea of what the layout should be.
For future, I would maybe think ahead of what parts of the code I can put into a method. |

@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 ✔️yes - for operations. Consider using methods for checking for valid user input.

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. You've used some clever syntax to implement the required logic. I've left a couple comments for you to review, but overall it is clear that the learning goals 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?
Elegant/Clever
Descriptive/Readable
Logical/Organized

puts "Welcome to the calculator program where you are able to either add, subtract, divide, or multiply two numbers."

#take in the numbers and operation the user would like to perform
puts "Input your first number--"

Choose a reason for hiding this comment

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

Nice work making sure the user input is valid! This code is repeated below for the second number -- as such this would be a great opportunity to use a method to DRY up your code.

puts subtract(num_1, num_2)
when "divide", "/"
if num_2 == 0 #if the user wants to divide a number by zero
puts "0"

Choose a reason for hiding this comment

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

Consider printing a more informative message.

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