Skip to content

Conversation

@jetabajrami
Copy link

@jetabajrami jetabajrami commented Feb 6, 2020

Assignment Submission: Calculator

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions:

Reflection

Question Answer
What went well in your code style, such as indentation, spacing, variable names, readability, etc.? What was lacking? In general, I like my code style and I think if I will incorporate more math operators, my program will look better.
How did your code keep track of user input? Second method keep track of the user input, if the input is valid or not.
How did your code determine what operation to perform? I made that happen by creating the first method.
What opportunities exist to create small methods for this project? I think in the first method that I have created, there are some opportunities to write that method with less code . Also, I think that I can incorporate second method on the first one, but I could't make that work.
In the next project, what would you change about your process? What would you keep doing? I will try to make that more readable. And maybe to comment more in details.

Day 2 - Ada Homework - Calculator
This is my first draft and I upload my second one alredy.
Modify line nr 26
@CheezItMan
Copy link

Calculator

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly uses conditionals (if/else/elsif) ✔️
Correctly uses loops (while/until) ✔️
Correctly uses gets.chomp ✔️
Correctly uses variables ✔️
Correctly creates and uses custom methods ✔️, nice custom methods

Functional Requirements

Functional Requirement yes/no
User can input two numbers and an operator and perform addition ✔️
User can input in two numbers and an operator and can perform subtraction ✔️
User gets feedback from the CLI when attempting to divide by zero, and the program does not give an error ⚠ instead it just reports infinity.

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 3+ in Code Review && 2+ in Functional Requirements ✔️

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation ⚠ You have a lot of messy indentation here.
Elegant/Clever
Descriptive/Readable
Concise
Logical/Organized

Summary

Nice work, you hit the learning goals here. I like your methods, they work quite well. However you should work to properly indent code.

result = ((num_one.to_f) * (num_two.to_f)).round(2)
elsif math_operation == "Divide" || math_operation == "/"
result = ((num_one.to_f) / (num_two.to_f)).round(2)
end

Choose a reason for hiding this comment

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

indentation

Suggested change
end
end

Comment on lines +16 to +22
def ValidOperator (math_operation)
until ["Add","+", "Subtract","-", "Multiply", "*", "Divide", "/"].include? math_operation
puts "Enter a valid selection"
math_operation = gets.chomp
end
return math_operation
end

Choose a reason for hiding this comment

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

indentation issues here.

Comment on lines +27 to +29
puts "Enter a valid number"
number = gets.chomp.to_i
end

Choose a reason for hiding this comment

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

More messy indentation.

@@ -0,0 +1,56 @@
#Add,Subtract,Multiply,Divide Methode
def operation(num_one, math_operation, num_two)
if math_operation == "Add" || math_operation == "+"

Choose a reason for hiding this comment

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

I suggest capitalizing math_operation, before starting these if-elsif comparisons.

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