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

Fulfilled all the conditions of the task. Created classes of figures,… #1751

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

Conversation

Jacalius
Copy link

… interfaces and implemented methods.

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 Pull Request! 😊 While your code is mostly well-implemented, there are a few critical issues that need to be addressed before we can approve it:

  1. Method Naming: There is a typo in the method name getRundomFigure() in the FigureSupplier class. It should be corrected to getRandomFigure() to ensure consistency and avoid confusion.

  2. Variable Naming: The IsoscelesTrapezoid class has a typo in the field name hight. This should be corrected to height to maintain clarity and correctness.

  3. Type Safety: Across several classes, consider using the Color enum instead of a String for the color parameter. This change will improve type safety and maintain consistency with the rest of your code.

  4. Method Implementation: In the RightTriangle class, the draw() method incorrectly labels the shape as 'Rectangle'. Please correct this to 'RightTriangle' to accurately reflect the class functionality.

These changes are important to ensure your code is robust, maintainable, and aligned with the task requirements. Once you've addressed these issues, we can proceed with the approval. Keep up the great work, and don't hesitate to reach out if you need any help! 🚀

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

private ColorSupplier supplier = new ColorSupplier();
private Random random = new Random();

public Figure getRundomFigure() {

Choose a reason for hiding this comment

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

There is a typo in the method name getRundomFigure(). It should be corrected to getRandomFigure().

private Random random = new Random();

public Figure getRundomFigure() {
String color = supplier.getRandomColor();

Choose a reason for hiding this comment

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

Instead of using String for color, consider using the Color enum directly to improve type safety and align with the task requirements.

}

public Figure getDefaultFigure() {
return new Circle(DEFAULT_RADIUS, Color.WHITE.name());

Choose a reason for hiding this comment

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

When creating the default figure, consider passing the Color.WHITE enum directly instead of using Color.WHITE.name() to maintain consistency with the use of enums.

public class IsoscelesTrapezoid extends Figure {
private int bottomBase;
private int topBase;
private int hight;

Choose a reason for hiding this comment

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

The variable name hight is misspelled. It should be corrected to height.

private int topBase;
private int hight;

public IsoscelesTrapezoid(int bottomBase, int topBase, int hight, String color) {

Choose a reason for hiding this comment

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

Consider using the Color enum instead of a String for the color parameter to maintain type safety and consistency with the rest of the code.


for (int i = 0; i < figures.length; i++) {
if (i < figures.length / 2) {
figures[i] = figureSupplier.getRundomFigure();

Choose a reason for hiding this comment

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

There is a typo in the method call getRundomFigure(). It should be corrected to getRandomFigure() to match the method name in the FigureSupplier class.

private int length;
private int width;

public Rectangle(int length, int width, String color) {

Choose a reason for hiding this comment

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

Consider using the Color enum instead of a String for the color parameter to maintain type safety and consistency with the rest of the code.

}

@Override
public void draw() {

Choose a reason for hiding this comment

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

The draw() method incorrectly labels the shape as 'Rectangle'. It should be corrected to 'RightTriangle'.

private int legA;
private int legB;

public RightTriangle(int legA, int legB, String color) {

Choose a reason for hiding this comment

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

Consider using the Color enum instead of a String for the color parameter to maintain type safety and consistency with the rest of the code.

public class Square extends Figure {
private int side;

public Square(int side, String color) {

Choose a reason for hiding this comment

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

Consider using the Color enum instead of a String for the color parameter to maintain type safety and consistency with the rest of the code.

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.

Great job on your submission! 🎉 Your code implementation mostly meets the task requirements, and you've made significant progress. Here are a few points to consider for improvement:

  1. Typo Corrections:

    • In the IsoscelesTrapezoid class, ensure that the field and parameter name hight is corrected to height throughout the class, including the constructor and the draw() method. This will enhance clarity and correctness.
    • In the FigureSupplier class, the method name getRundomFigure() has been corrected to getRandomFigure(), which is great for consistency.
  2. Area Calculation:

    • Double-check the getArea() method in the IsoscelesTrapezoid class to ensure it uses the correct formula: ((bottomBase + topBase) / 2) * height.
  3. Code Readability:

    • Consider using separate variables for complex expressions passed to constructors to improve code readability, as suggested in the checklist.

Your efforts are commendable, and these adjustments will help you refine your skills further. Keep up the good work, and make sure to address these points in future projects to avoid similar issues. Happy coding! 😊

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

private ColorSupplier supplier = new ColorSupplier();
private Random random = new Random();

public Figure getRandomFigure() {

Choose a reason for hiding this comment

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

There is a typo in the method name getRundomFigure(). It should be corrected to getRandomFigure() to ensure consistency and avoid confusion.

Comment on lines +17 to +21
case 0 -> new Circle(randomSide, color);
case 1 -> new IsoscelesTrapezoid(randomSide, randomSide, randomSide, color);
case 2 -> new Rectangle(randomSide, randomSide, color);
case 3 -> new RightTriangle(randomSide, randomSide, color);
case 4 -> new Square(randomSide, color);

Choose a reason for hiding this comment

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

Consider creating separate variables for expressions passed to constructors for better code readability, as suggested in the checklist.

public class IsoscelesTrapezoid extends Figure {
private int bottomBase;
private int topBase;
private int hight;

Choose a reason for hiding this comment

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

There is a typo in the field name hight. It should be corrected to height to maintain clarity and correctness.

Comment on lines 8 to 11
public IsoscelesTrapezoid(int bottomBase, int topBase, int hight, Color color) {
this.bottomBase = bottomBase;
this.topBase = topBase;
this.hight = hight;

Choose a reason for hiding this comment

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

Ensure that the parameter name hight is corrected to height in the constructor as well.


@Override
public double getArea() {
return ((bottomBase + topBase) / 2) * hight;

Choose a reason for hiding this comment

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

Ensure that the calculation in getArea() is correct according to the formula for the area of an isosceles trapezoid: ((bottomBase + topBase) / 2) * height.

@Override
public void draw() {
System.out.println("IsoscelesTrapezoid, area: " + getArea() + " sq. units, bottomBase: "
+ bottomBase + " units, topBase: " + topBase + " units, hight: " + hight

Choose a reason for hiding this comment

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

Ensure that the field name hight is corrected to height in the draw() method as well.

}

@Override
public void draw() {

Choose a reason for hiding this comment

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

Ensure that the draw() method correctly labels the shape as 'RightTriangle'.

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