Skip to content

Conversation

@brilatimer
Copy link

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What went well in your code style, such as indentation, spacing, variable names, readability, etc.? What was lacking? Tried to use clear variable naming, implemented comments for readability, checked spacing and indentation.
How did your code keep track of user input? By naming each user input entry a specific variable (jellyfish = gets.chomp). I also reinstated user input onscreen to confirm entries.
How did your code determine what operation to perform? By using case command (line 81-end) to identify operator list and associate with actual operator symbol
What opportunities exist to create small methods for this project? My code accepts 0 as a number input, which I realize loopholes the 'divide by zero' buffer I built. I could improve this by rejecting the input of 0 and re-looping new user input. Going to try and update this.
In the next project, what would you change about your process? What would you keep doing? I could spend more time creating my own custom methods. I will keep using case command - I like it 🎉

@dHelmgren
Copy link

Calculator

What We're Looking For

Feature Feedback
Readable code with consistent indentation mostly, see comment
Practices using variables appropriately yes
Practices using conditionals appropriately yes
If any, practices iteration appropriately yes
If any, practices using custom methods appropriately yes
Takes in two numbers and an operator and can perform addition yes
Takes in two numbers and an operator and can perform subtraction yes
The program handles divide when attempting to divide by zero yes

--- | ---
Overall | Good work! This meets all the learning goals for the assignment.

if string.length == 0
return false
end
return string.scan(/\D/).empty?

Choose a reason for hiding this comment

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

This is a neat way to check if it's a number! If you found this out on the web, don't forget to cite your source!

puts "Welcome to the Calculator program! I hear you need help..."
puts "Which operator would you like to use from the below list?"
4.times do |i|
puts "#{i+1}: #{operators[i][0]} (#{operators[i][1]})"

Choose a reason for hiding this comment

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

Nice use of a loop

# use case command to complete equation
case operator_pick
when "add", "+"
puts (num_one_pick + num_two_pick)

Choose a reason for hiding this comment

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

These puts should be indented further than the whens in this block!

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