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

Maria McGrew - Carets - calculator #33

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

Maria McGrew - Carets - calculator #33

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 11, 2017

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program. Stored them in variables within methods
How did you determine what operation to perform? Used a hash to store the options for operations and used an until loop to ask for an operation until the user entered a valid one.
How did you make sure your program behaved correctly? Tested the various cases such as using negative numbers, letters, decimals, and dividing by zero.
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've done the optional part to determine if the user entered an integer or float and had the program respond appropriately.

@CheezItMan
Copy link

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. Check, although you do have a bug when the user enters 0 for a denominator.
Baseline
Readable code with consistent indentation. Check
Extras
Summary Nice work, you read in numbers and the operators from the keyboard and perform the operation. You also keep the user from entering false numbers. Nice work.


def num_input
print "Enter a number: "
number = Float(gets.chomp) rescue nil

Choose a reason for hiding this comment

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

Do be careful when doing this. We haven't talked about rescue yet, but later on a solution like this for other things could be frowned upon. More info is here

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.

1 participant