-
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
Realized the creation of a generator of geometric shapes with random … #1753
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.
Thank you for your hard work on this project! 😊 While your code is generally well-structured and meets many of the task requirements, there are a few critical issues that need to be addressed before we can approve the pull request:
-
Constructor Error in
Rectangle
Class: There's a critical mistake in the constructor wherethis.width
is assigned twice, which affects the functionality of the area calculation. This needs to be corrected tothis.height = height;
. -
Variable Naming in
RightTriangle
Class: The typo in the variable namefistLeg
should be corrected tofirstLeg
to ensure clarity and maintainability. -
Accessibility of
color
Field: Ensure that thecolor
field in theFigure
class is accessible in theCircle
class. Ifcolor
is private, consider adding a getter method inFigure
.
These issues are important to resolve as they impact the functionality and clarity of your code. Once these are fixed, your code will be in great shape! Keep up the excellent work, and don't hesitate 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.
System.out.println("Figure: circle, area: " + getArea() | ||
+ " radius: " + radius + " color " + color); |
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 color
field is accessed directly, assuming it is a protected or public field in the Figure
class. If color
is private in Figure
, you need to provide a getter method in Figure
to access it.
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.
🔄 Исправьте проблемы, внесите изменения, а затем повторно запросите мою проверку с помощью Re-request reviewкнопки на вкладке «Рецензенты».
Где эта кнопка?
|
||
public class ColorSupplier { | ||
private static final Random random = new Random(); | ||
private static final String[] Colors = {"red", "blue", "yellow", "green", "purple", "black"}; |
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 array Colors
should follow the Java naming convention for constants, which is all uppercase letters with words separated by underscores. Consider renaming it to COLORS
.
import java.util.Random; | ||
|
||
public class FigureSupplier { | ||
private static final Random random2 = new Random(); |
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 variable random2
should follow a more descriptive naming convention. Consider renaming it to random
or randomGenerator
for clarity.
public Rectangle(String color, double width, double height) { | ||
super(color); | ||
this.width = width; | ||
this.width = 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 a mistake in the constructor: this.width = height;
should be this.height = height;
. This error causes the height
field to be incorrectly initialized, affecting the area calculation.
package core.basesyntax; | ||
|
||
public class RightTriangle extends Figure { | ||
private double fistLeg; |
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 a typo in the variable name fistLeg
. It should be firstLeg
to accurately describe the first leg of the triangle.
Realized the creation of a generator of geometric shapes with random values