Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solution #1774

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

solution #1774

wants to merge 2 commits into from

Conversation

ivanlavrinenko
Copy link

No description provided.

Copy link

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


Thank you for your hard work on this project! While your code is mostly on the right track, there are a few critical issues that need to be addressed before we can approve the pull request:

  1. Incorrect Area Calculation in Circle Class: The formula for calculating the area of a circle is incorrect. Please update it to Math.PI * Math.pow(radius, 2) to ensure accurate calculations.

  2. Incorrect toString Method in IsoscelesTrapezoid Class: The toString method currently labels the figure as a "right triangle" instead of "isosceles trapezoid". Please correct this to accurately reflect the figure type.

  3. Constructor Parameter Naming in IsoscelesTrapezoid Class: The parameter side is misleading as it is used to set the height. Consider renaming it to height for better clarity.

  4. Missing draw() Method: The task specifies that figures should have a draw() method to print out all information about the figure. This method is currently missing and needs to be implemented.

Once these issues are resolved, your code will be in great shape! Keep up the good work, and feel free to reach out if you have any questions or need further assistance. 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

Comment on lines +22 to +23
public double calculateArea() {
return 2 * Math.pow(radius, 2) * Math.PI;

Choose a reason for hiding this comment

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

The formula for calculating the area of a circle is incorrect. It should be Math.PI * Math.pow(radius, 2) instead of 2 * Math.pow(radius, 2) * Math.PI. Please correct this to ensure the area is calculated properly.

Comment on lines +10 to +14
public IsoscelesTrapezoid(Color color, double top, double bottom, double side) {
super(color);
this.top = top;
this.bottom = bottom;
this.height = side;

Choose a reason for hiding this comment

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

The constructor parameter side is misleading as it is used to set the height. Consider renaming it to height for clarity.


@Override
public String toString() {
return "Figure: right triangle"

Choose a reason for hiding this comment

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

The toString method incorrectly describes the figure as a 'right triangle'. It should be 'isosceles trapezoid'. Please update the description to accurately reflect the figure type.

Comment on lines 20 to 24
case SQUARE -> new Square(color, RANDOM.nextDouble());
case RECTANGLE -> new Rectangle(color, RANDOM.nextDouble(), RANDOM.nextDouble());
case RIGHT_TRIANGLE -> new RightTriangle(color, RANDOM.nextDouble(), RANDOM.nextDouble());
case CIRCLE -> new Circle(color, RANDOM.nextDouble());
default -> new IsoscelesTrapezoid(color, RANDOM.nextDouble(), RANDOM.nextDouble(), RANDOM.nextDouble());

Choose a reason for hiding this comment

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

The RANDOM.nextDouble() method generates a random double between 0.0 and 1.0. If you want to have a more meaningful range for the dimensions of the figures, consider scaling the random values by a factor or using a different method to generate them.

Copy link

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

Thank you for your submission! 🎉 Your code is on the right track, but there are a few critical issues that need attention to ensure full functionality:

  1. Circle Area Calculation: The formula for calculating the area of a circle is incorrect. Please update it to Math.PI * Math.pow(radius, 2) for accurate results.

  2. IsoscelesTrapezoid toString Method: The toString method currently labels the figure as a "right triangle" instead of "isosceles trapezoid". Please correct this to reflect the correct figure type.

  3. IsoscelesTrapezoid Constructor Parameter: The parameter side is misleading as it is used to set the height. Consider renaming it to height for better clarity.

  4. Random Dimensions Constraints: The random dimensions for figures are not constrained, which might lead to impractically small or large figures. Adding constraints to these values will improve usability.

  5. Missing draw() Method: Ensure that each figure class implements a draw() method to print out all information about the figure, as specified by the task.

These changes will not only improve the accuracy and clarity of your code but also enhance its usability. Keep up the good work, and continue learning from these experiences! 💪

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +22 to +23
public double calculateArea() {
return 2 * Math.pow(radius, 2) * Math.PI;

Choose a reason for hiding this comment

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

The formula for calculating the area of a circle is incorrect. It should be Math.PI * Math.pow(radius, 2) instead of 2 * Math.pow(radius, 2) * Math.PI. Please update this to ensure accurate area calculations.

private double bottom;
private double height;

public IsoscelesTrapezoid(Color color, double top, double bottom, double side) {

Choose a reason for hiding this comment

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

The constructor parameter side is misleading as it is used to set the height. Consider renaming it to height for better clarity.


@Override
public String toString() {
return "Figure: right triangle"

Choose a reason for hiding this comment

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

The toString method incorrectly labels the figure as a 'right triangle'. It should be 'isosceles trapezoid' to accurately reflect the figure type.

Comment on lines +24 to +44
case SQUARE -> new Square(color, RANDOM.nextDouble());
case RECTANGLE -> new Rectangle(
color,
RANDOM.nextDouble(),
RANDOM.nextDouble()
);
case RIGHT_TRIANGLE -> new RightTriangle(
color,
RANDOM.nextDouble(),
RANDOM.nextDouble()
);
case CIRCLE -> new Circle(
color,
RANDOM.nextDouble()
);
default -> new IsoscelesTrapezoid(
color,
RANDOM.nextDouble(),
RANDOM.nextDouble(),
RANDOM.nextDouble()
);

Choose a reason for hiding this comment

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

The random dimensions generated for the figures (e.g., side lengths, radius) are not constrained, which might result in impractically small or large figures. Consider adding constraints to the random values to ensure they fall within a reasonable range.

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