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

Shaunna Wiens --Carets #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Shaunna Wiens --Carets #31

wants to merge 3 commits into from

Conversation

skwiens
Copy link

@skwiens skwiens commented Aug 11, 2017

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program. as variables
How did you determine what operation to perform? Based off what the user entered. I first created a program that prompted the user to enter a number followed by an operation followed by a number. In this version the user could enter they mathematical symbol (/) or the word "divide." I then tried to create a version in which the user could input an entire line directly. I attempted to create a way for the program to replace any occurrences of words with math symbols, but mostly broke the program trying to do so.
How did you make sure your program behaved correctly? I ran several tests. Right now it does not behave correctly. Subtraction is a problem.
Do you feel like you used consistent indentation throughout your code? I started to. But as I changed things I had to indent things more than they started and now I'm not sure. If I had more time I would go back through and check!
If you had more time, what would you have added to or changed about the program? I am currently working on parenthesis. I had an almost working version with parenthesis in which they were replaced with the value inside. It has trouble printing the output. I would also do several more tests and debugging because currently there are entries which don't work. Currently my program cannot subtract. :(

Forgot a pipe.

Also added comments that should have been done as I was working...
Updated to prompt user to enter a valid math expression if they don't include an operator in their input
@CheezItMan
Copy link

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. After fixing a small mistake, yes.
Baseline
Readable code with consistent indentation. Check
Extras Does exponentiation, used regex, figures out if the numbers are whole numbers or not.
Summary Well done, small typo, but it looks like you fixed the subtraction. I like how you incorporated regular expressions in your solution. Nicely done.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

nicely done, just a little feedback on a syntax error.

computation = gets.chomp

#Prompts user to enter a valid math expression if they don't include an operator.
while math_hash.to_a.flatten & computation.split("") == []

Choose a reason for hiding this comment

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

You should probably take out the math_hash.to_a.flatten in this while loop.

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