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

Create Pipes - <Roxanne Agerone> - <Calculator> #36

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

Conversation

RAgerone
Copy link

@RAgerone RAgerone commented Aug 11, 2017

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program. I stored user input in two ways. The numbers that are input are stored in an array. The input for the type of math used is sent through a method called "doing_maths", where the function determines the type of math to be done and calls the correct math method on the numbers.
How did you determine what operation to perform? I used regex. The syntax was difficult for me. I found that when comparing a string with regex, if the answer is not nil, then it has some string that is included in regex.
How did you make sure your program behaved correctly? I used irb -r to make sure my methods worked individually. I did have problems with my terminal getting overwhelmed.
Do you feel like you used consistent indentation throughout your code? Yes, but that is mostly because Atom would tell me if my indentation wasn't right. Also, I was having problems with my editing and having too many ends, so that forced me to look at all the notes that Atom was giving me.
If you had more time, what would you have added to or changed about the program? I would like to find out how to use regex to compare multiple string parts without using a pipe for "or" in one line. I would like the program to be more intuitive instead of adding individual math from two numbers.

numbers = []
puts "give me two numbers"
num = gets.chomp.to_f
numbers.push(num)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Watch your indentation here - lines 11 and 12 should be at the same level as line 10.


def divide(a, b)
if b == 0
puts "Dividing by zero is tricky! We will discuss this when we do calculus.
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 something like division where you have an extra check to make it results in much cleaner code.

@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. Mostly - see inline comments

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