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

Developed random figure functionality #1730

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

Conversation

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

Great job on implementing the core functionality of the task! 🎉 While there are a few minor issues like redundant semicolons and magic numbers, they don't significantly impact the functionality of your code. Keep up the good work, and consider addressing these minor points for cleaner and more maintainable code in the future. Happy coding! 😊

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


public Figure getRandomFigure() {
int figureIndex = random.nextInt(NUMBER_OF_FIGURES);
String color = colorSupplier.getRandomColor().toLowerCase();

Choose a reason for hiding this comment

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

The colorSupplier.getRandomColor().toLowerCase() line converts the color to lowercase. Ensure that this is intentional and that the rest of the application handles lowercase color names correctly.

public Figure getRandomFigure() {
int figureIndex = random.nextInt(NUMBER_OF_FIGURES);
String color = colorSupplier.getRandomColor().toLowerCase();
double figureProperty = 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() generates a value between 0.0 and 1.0. Ensure that this range is appropriate for the properties of the figures being created.

}

for (Figure figure : figures) {
figure.draw();;

Choose a reason for hiding this comment

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

There is an extra semicolon after figure.draw();. This is not a critical issue, but it is unnecessary and can be removed for cleaner code.

super(color);
this.width = width;
this.height = height;
this.diagonal = Math.sqrt(width * width + height * height);;

Choose a reason for hiding this comment

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

There is an extra semicolon at the end of the line after calculating the diagonal. This is not a critical issue, but it is unnecessary and can be removed for cleaner code.

Comment on lines +19 to +20
+ getArea() + " units, side: " + side
+ "5 units, color: " + getColor());

Choose a reason for hiding this comment

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

There seems to be a typo in the draw method output: + "5 units, color: " + getColor(). The 5 should likely be removed to correctly display the side length and color.

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