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 - <Lindsey> - <Calculator> #27

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

Conversation

VirtualLindsey
Copy link

Pipes - -

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program. in a variable
How did you determine what operation to perform? I tested it
How did you make sure your program behaved correctly? there is error checking
Do you feel like you used consistent indentation throughout your code? yes, probably
If you had more time, what would you have added to or changed about the program? I'd use a hash to hold the mapping between inputs and math operations and consolidate the method doing the math into fewer lines into only one case

Pipes - <Lindsey Deuel> - <Calculator>
return do_math("/", numbers[0], numbers[1])
elsif operation == "modulo" || operation == "%"
return do_math("%", numbers[0], numbers[1])
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the user inputs a bogus operator, your program quits silently. Instead, it would be polite to let them know what went wrong.

def do_math(operation,num1, num2)
if operation == "+"
puts "#{num1} + #{num2} = #{num1+num2}"
elsif operation == "-"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This big if statement looks very similar to the one in process_operator - would it be possible to consolidate the two?


def get_number(operation)
begin
puts "What's your first number?"
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 making getting a number from the user its own method - good organization.

@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

Great work overall!

@VirtualLindsey VirtualLindsey changed the title Pipes - <Lindsey Deuel> - <Calculator> Pipes - <Lindsey> - <Calculator> Oct 5, 2019
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