add task solution#3321
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation meets all core requirements. The Triangle, Circle, and Rectangle classes correctly implement the Figure interface with proper shape, color, and getArea() methods. All area calculations use the correct formulas (Heron's formula, Math.PI, and base×height) with proper rounding. The only issue identified is that the Triangle validation error message is misleading—while the validation logic correctly detects when sides cannot form a triangle (longest side >= sum of others), the error text incorrectly states "All sides of the triangle must be positive numbers." This is a non-blocking quality concern since the validation still functions correctly and throws an error for invalid triangles. However, for better user experience, consider updating the message to explicitly explain that the sides cannot form a valid triangle, such as: "Sides {a}, {b}, {c} cannot form a triangle because the longest side must be less than the sum of the other two sides." All other checklist items pass, including proper use of class modifiers and the getInfo function format. Good work on meeting the requirements!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
|
|
||
| if (a >= b + c || b >= c + a || c >= a + b) { | ||
| throw new Error('All sides of the triangle must be positive numbers.'); |
There was a problem hiding this comment.
This error message is misleading. This validation checks if the triangle inequality is violated (longest side >= sum of others), but the message says sides must be positive. Per checklist item #3, provide a detailed description. For example: 'Sides {a}, {b}, {c} cannot form a triangle because the longest side must be less than the sum of the other two sides.'
No description provided.