Skip to content

Conversation

@ChelseaC13
Copy link

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? I figured out the Data Validation for everything (I think). It took a while, but since I accomplished it, I think it did go well. On the flip side, it took a while and could probably be prettier.
How did your code keep track of user input? I asked for input and kept it stored in the variable.
How did your code determine what operation to perform? I used the user input in a case statement instead of using a lot of if statements to perform the math.
What opportunities exist to create small methods for this project? I created methods for data validation for operator and number inputs. You could probably use methods to collect user input too.
In the next project, what would you change about your process? What would you keep doing? Turns out I did not need to do as much data validation as I did. I like it, but it took a while, so I think I will keep with the base project first and not go on tangents.

@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 ✔️

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 ✔️

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?
Elegant/Clever
Descriptive/Readable
Concise ⚠ , some could be simplified a bit.
Logical/Organized

Summary

Nicely done, you hit all the learning goals here. Well done, this makes a good start at Ada.

end

def valid_number(number)
alphabet_array = [*'a'..'z', *'A'..'Z'] # https://stackoverflow.com/questions/4846853/generate-array-of-all-letters-and-digits

Choose a reason for hiding this comment

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

👍 Nice work with the citation.

alphabet_array = [*'a'..'z', *'A'..'Z'] # https://stackoverflow.com/questions/4846853/generate-array-of-all-letters-and-digits
operator_array = ["!","@","#","$","%","^","&","(",")","[","]","{","}","?","_","``","~","|","<",">",",",";",":","=","+","-","*","/"]
if number == 0 && number.to_i.to_s == number #for when people truly put in 0
return "yes"

Choose a reason for hiding this comment

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

It would probably be better to return true if it is a number, and false if it isn't.

end

case operator
when "add","+"

Choose a reason for hiding this comment

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

In general the when should be indented under the case statement.

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