Skip to content

Solution#3326

Open
leandrolima25prog wants to merge 2 commits into
mate-academy:masterfrom
leandrolima25prog:develop
Open

Solution#3326
leandrolima25prog wants to merge 2 commits into
mate-academy:masterfrom
leandrolima25prog:develop

Conversation

@leandrolima25prog
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

There are contradictions between the individual file reviews and the general summary that need clarification. The file comments indicate violations of checklist items #3 and #4: (1) Constructors manually assign properties (this.color = color;, this.a = a;, etc.) instead of using implicit property creation with public access modifiers on constructor parameters - this affects Triangle (lines 12, 14, 16, 18), Circle (lines 48, 50), and Rectangle (lines 71, 73, 75); (2) The Triangle error message doesn't include actual side values for better debugging. However, the general summary claims these items 'PASS' with 'no issues found.' Please ensure the implementation uses TypeScript's shorthand property declaration pattern by adding public to constructor parameters and removing manual property declarations, and include the actual side values in the Triangle error message for better traceability.


✨ 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 +20 to +33

constructor(color: ColorType, a: number, b: number, c: number) {
if (a <= 0 || b <= 0 || c <= 0) {
throw new Error('Sides must be greater than 0');
}

if (a >= b + c || b >= a + c || c >= a + b) {
throw new Error("Sides can't form a triangle");
}

this.color = color;
this.a = a;
this.b = b;
this.c = c;
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 #4 violation: This constructor manually assigns properties (this.color = color;, this.a = a;, etc.) but TypeScript can implicitly create properties when constructor parameters have access modifiers. Remove the property declarations (lines 12, 14, 16, 18) and add public to constructor parameters to let TypeScript handle property creation automatically.

Comment thread src/figuresClasses.ts Outdated
Comment on lines +46 to +58
export class Circle implements Figure {
shape: ShapeType = 'circle';

color: ColorType;

export class Circle implements Figure {}
radius: number;

export class Rectangle implements Figure {}
constructor(color: ColorType, radius: number) {
if (radius <= 0) {
throw new Error('Radius must be greater than 0');
}

this.color = color;
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 #4 violation: Similar to Triangle, this constructor manually assigns properties. Add public to constructor parameters and remove the property declarations (lines 48, 50) to follow the implicit property creation pattern.

Comment thread src/figuresClasses.ts Outdated
Comment on lines +69 to +84
export class Rectangle implements Figure {
shape: ShapeType = 'rectangle';

color: ColorType;

width: number;

height: number;

constructor(color: ColorType, width: number, height: number) {
if (width <= 0 || height <= 0) {
throw new Error('Width and height must be greater than 0');
}

this.color = color;
this.width = width;
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 #4 violation: This constructor also manually assigns properties. Add public to constructor parameters and remove the property declarations (lines 71, 73, 75) to follow the implicit property creation pattern.

Comment thread src/figuresClasses.ts
throw new Error('Sides must be greater than 0');
}

if (a >= b + c || b >= a + c || c >= a + b) {
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: The error message could be more informative. Consider including the actual side values, e.g., 'Triangle with sides ${a}, ${b}, and ${c} cannot be formed: the longest side must be less than the sum of the other two sides'

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. All requirements are met: the three figure classes (Triangle, Circle, Rectangle) correctly implement the Figure interface with proper area calculations using Heron's formula for triangles and Math.PI for circles, areas are rounded down to hundredths, constructors use TypeScript's implicit property creation via public access modifiers, error handling includes detailed validation messages with actual values, and the getInfo method returns the correct format. The implementation follows all checklist guidelines without any issues.


✨ 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