Conversation
CalculatorMajor Learning Goals/Code Review
Functional Requirements
Overall Feedback
Additional FeedbackGreat 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 AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
beccaelenzil
reviewed
Feb 7, 2020
| 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--" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Consider printing a more informative message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assignment Submission: Calculator
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions:
Reflection
| 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. |