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

complete a task #1331

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

complete a task #1331

wants to merge 6 commits into from

Conversation

FkordJava
Copy link

No description provided.

Comment on lines 10 to 12

public abstract void obtainTheArea();

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

Comment on lines 11 to 14
@Override
public void obtainTheArea() {
setArea(Math.PI * Math.pow(radius, 2));
}

Choose a reason for hiding this comment

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

It`s redundant method

Comment on lines 12 to 13
public String getDefaultColor() {
return Color.WHITE.toString();

Choose a reason for hiding this comment

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

same

Comment on lines 8 to 9
public String getRandomColor() {
return Color.values()[random.nextInt(Color.values().length)].toString();

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;

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;

Choose a reason for hiding this comment

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

Empty line

Comment on lines 15 to 18
@Override
public void obtainTheArea() {
setArea((double) (baseLength + smallerSideLength) / 2 * height);
}

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];

Choose a reason for hiding this comment

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

Magic number

@FkordJava FkordJava requested a review from Sanderfuck October 20, 2023 14:13
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.

3 participants