add task solution#3336
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
This implementation has critical issues that must be fixed before approval. The core problems are: 1. Non-descriptive error messages — All three classes use the placeholder 'your error message'. This violates [CHECKLIST ITEM #3], which explicitly requires descriptive error messages. You must replace these with actual explanations like 'Triangle sides must be positive numbers', 'Circle radius must be a positive number', and 'Rectangle width and height must be positive numbers'. 2. Incorrect rounding in Triangle's getArea — The task requires rounding DOWN to hundredths, but (a * b * c) / 4 is wrapped in Math.round, which rounds to the nearest value (potentially up). Use Math.floor(area * 100) / 100 instead. 3. Missing rounding in Rectangle's getArea — The method returns this.width * this.height without any rounding, but the requirement specifies "rounded down to hundredths". Add Math.floor(this.width * this.height * 100) / 100. The structure, interface implementation, and most logic are correct — these are the only blocking issues preventing approval.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| if (a <= 0 || b <= 0 || c <= 0) { | ||
| throw new Error('your error message'); |
There was a problem hiding this comment.
Checklist item #3 violation: Error messages should be descriptive. Replace generic 'your error message' with actual error descriptions like 'Triangle sides must be positive numbers' or 'Triangle sides must satisfy triangle inequality'.
| if (Math.max(a, b, c) >= a + b + c - Math.max(a, b, c)) { | ||
| throw new Error('your error message'); |
There was a problem hiding this comment.
Checklist item #3 violation: This error message should describe the actual problem, e.g., 'Sides 1, 2 and 3 cannot form a triangle because the longest side must be less than the sum of the other two sides'.
| if (radius <= 0) { | ||
| throw new Error('your error message'); |
There was a problem hiding this comment.
Checklist item #3 violation: Replace with a descriptive message like 'Circle radius must be a positive number'.
| if (width <= 0 || height <= 0) { | ||
| throw new Error('your error message'); |
There was a problem hiding this comment.
Checklist item #3 violation: Replace with a descriptive message like 'Rectangle width and height must be positive numbers'.
| getArea(): number { | ||
| const s = (this.a + this.b + this.c) / 2; | ||
| const area = Math.sqrt(s * (s - this.a) * (s - this.b) * (s - this.c)); | ||
|
|
||
| return Math.round(area * 100) / 100; |
There was a problem hiding this comment.
The task requires rounding DOWN to hundredths (floor), but Math.round rounds to nearest. Use Math.floor(area * 100) / 100 to match the Circle implementation.
| getArea(): number { | ||
| return this.width * this.height; |
There was a problem hiding this comment.
The task requires rounding DOWN to hundredths (floor to 2 decimal places). Currently no rounding is applied. Use Math.floor(this.width * this.height * 100) / 100.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The implementation is nearly complete, but Rectangle.getArea is missing the required rounding to hundredths. Per the task requirements, all three figure classes must round down to hundredths — this applies to Rectangle just like Triangle and Circle. Rectangle.getArea currently returns this.width * this.height without rounding. Compare this to Circle's implementation which correctly uses Math.floor(... * 100) / 100. Wrap the area calculation with Math.floor() the same way Circle and Triangle do: javascript getArea() { return Math.floor(this.width * this.height * 100) / 100; } This is the only remaining blocker between your code and a passing submission. Everything else — error messages, interface compliance, constructor parameters, and the rounding in Triangle and Circle — is correctly implemented.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| getArea(): number { | ||
| return this.width * this.height; |
There was a problem hiding this comment.
Rectangle's getArea returns the area without rounding down to hundredths. The task requires all figures to round down to hundredths. Compare with Circle's getArea which correctly uses Math.floor(... * 100) / 100.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved and working correctly. All three figure classes (Triangle, Circle, and Rectangle) now implement consistent rounding behavior using Math.floor(value * 100) / 100, which properly rounds down to hundredths. The interface, validation logic, error handling, and getInfo function are all properly implemented. Great job fixing the rounding issue in Rectangle and maintaining consistency across all classes!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.