-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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();; |
There was a problem hiding this comment.
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);; |
There was a problem hiding this comment.
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.
+ getArea() + " units, side: " + side | ||
+ "5 units, color: " + getColor()); |
There was a problem hiding this comment.
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.
No description provided.