Skip to content

add task solution#3336

Open
Roma-Yamshchikov wants to merge 3 commits into
mate-academy:masterfrom
Roma-Yamshchikov:develop
Open

add task solution#3336
Roma-Yamshchikov wants to merge 3 commits into
mate-academy:masterfrom
Roma-Yamshchikov:develop

Conversation

@Roma-Yamshchikov
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/figuresClasses.ts Outdated
Comment on lines +24 to +25
if (a <= 0 || b <= 0 || c <= 0) {
throw new Error('your error message');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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'.

Comment thread src/figuresClasses.ts Outdated
Comment on lines +28 to +29
if (Math.max(a, b, c) >= a + b + c - Math.max(a, b, c)) {
throw new Error('your error message');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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'.

Comment thread src/figuresClasses.ts Outdated
Comment on lines +54 to +55
if (radius <= 0) {
throw new Error('your error message');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3 violation: Replace with a descriptive message like 'Circle radius must be a positive number'.

Comment thread src/figuresClasses.ts Outdated
Comment on lines +78 to +79
if (width <= 0 || height <= 0) {
throw new Error('your error message');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3 violation: Replace with a descriptive message like 'Rectangle width and height must be positive numbers'.

Comment thread src/figuresClasses.ts Outdated
Comment on lines +38 to +42
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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread src/figuresClasses.ts Outdated
Comment on lines +87 to +88
getArea(): number {
return this.width * this.height;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/figuresClasses.ts Outdated
Comment on lines +92 to +93
getArea(): number {
return this.width * this.height;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

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! ✨

Footnotes

  1. Rate AI review example

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