-
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
complete a task #1331
base: master
Are you sure you want to change the base?
complete a task #1331
Conversation
created a constructor for the 'color' class
|
||
public abstract void obtainTheArea(); | ||
|
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.
Create interface AreaCalculator for working with area
@Override | ||
public void obtainTheArea() { | ||
setArea(Math.PI * Math.pow(radius, 2)); | ||
} |
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.
It`s redundant method
public String getDefaultColor() { | ||
return Color.WHITE.toString(); |
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.
same
public String getRandomColor() { | ||
return Color.values()[random.nextInt(Color.values().length)].toString(); |
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.
Can you use name instead of toString()?
|
||
public abstract class Figure implements Drawer { | ||
private final String color; | ||
private double area; |
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.
You don`t need this field
ISOSCELES_TRAPEZOID, | ||
CIRCLE, | ||
RIGHT_TRIANGLE; | ||
|
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.
Empty line
@Override | ||
public void obtainTheArea() { | ||
setArea((double) (baseLength + smallerSideLength) / 2 * 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.
Better use here getArea method
package core.basesyntax; | ||
|
||
public class Main { | ||
private static final Figure[] figures = new Figure[6]; |
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.
Magic number
No description provided.