Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipes - <Salome Wubeshet> - <Calculator> #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

swubeshet
Copy link

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program. I used the get.chomps method to retrieve user input and the user values were stored in the variable
How did you determine what operation to perform? I used an if/else statement that said if the user inputted '+' as their operation, it would also catch 'add' and 'addition'
How did you make sure your program behaved correctly? I checked for bugs by entering all the operational choices
Do you feel like you used consistent indentation throughout your code? Yes
If you had more time, what would you have added to or changed about the program? I would have wanted to find a way to account for floats.

@swubeshet swubeshet changed the title Create calculator.rb Pipes - <Salome Wubeshet> - <Calculator> Aug 11, 2017

def add(num1, num2)
return num1 + num2
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're using tabs for indentation - please use two spaces per level of indentation instead. It doesn't make a big difference one way or the other, but keeping our style consistent across the class will make it much easier when we start doing group projects.

You can set your editor up to do this automatically, let me know if you need help with this.


def division(num1, num2)
return num1 / num2
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like that you've split these out into separate methods! It may seem a little pedantic for things like + and -, but for more complicated methods (imagine finding the least common multiple of two numbers, or even checking for zero before doing division) it results in much cleaner code.

result = add(num1, num2)
puts "#{result}"
elsif(operation =='subtract' || operation == '-'|| operation == 'minus' )
result = subtract(num1, num2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You've got many lines here that all say puts #{result}. Would it be possible to DRY this code up somehow?

@droberts-sea
Copy link
Collaborator

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. Yes
Baseline
Readable code with consistent indentation. Yes, but see inline comment

Great work overall!

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