Skip to content

Conversation

@jocegonz
Copy link

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program. Input is stored into the variables operator, value1, value2.
How did you determine what operation to perform? I used I case statement.
How did you make sure your program behaved correctly? I checked it using every valid input along with bad inputs.
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 think I wouldn't have made so much effort checking for zeros and valid floats in the second value of a division operator. I would have called an error instead.

@jocegonz jocegonz changed the title Add files via upload Jocelyn Gonzalez --Carets Aug 11, 2017
@tildeee
Copy link

tildeee commented Aug 14, 2017

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. x
Baseline
Readable code with consistent indentation. x
Extras

#note: this doesn't also check if it's a valid float :(
until value2 != 0
puts "Please enter a valid value that isn't 0:"
value2 = gets.chomp.to_f
Copy link

Choose a reason for hiding this comment

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

Just a small note... in this flow, your code doesn't check if the new number that replaces 0 in "divide" operations using your valid_float? method. It doesn't matter too much in the end because .to_f actually handles it pretty well, but I just wanted to let you know!

@tildeee
Copy link

tildeee commented Aug 14, 2017

Great code! Your case statement is good! How you check for valid floats/input is also very interesting.

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