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

homework done #1778

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

homework done #1778

wants to merge 8 commits into from

Conversation

Ann1120-ua
Copy link

No description provided.

Copy link

@Elena-Bruyako Elena-Bruyako left a comment

Choose a reason for hiding this comment

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

fix build

package core.basesyntax;

public interface Drawable {
double area();

Choose a reason for hiding this comment

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

Drawable should be responsible only to draw information
create AreaCalculator interface to calculate area

Comment on lines 13 to 18
@Override
public abstract double area();

// Abstract method to draw the figure (implemented in subclasses)
@Override
public abstract void draw();

Choose a reason for hiding this comment

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

Suggested change
@Override
public abstract double area();
// Abstract method to draw the figure (implemented in subclasses)
@Override
public abstract void draw();

Figure[] figures = new Figure[FIGURE_COUNT];


for (int i = 0; i < 3; i++) {

Choose a reason for hiding this comment

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

combine into one for loop

Choose a reason for hiding this comment

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

fix comment


public class Main {
public static void main(String[] args) {
final int FIGURE_COUNT = 5;

Choose a reason for hiding this comment

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

it should be constant


@Override
public double area() {

Choose a reason for hiding this comment

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

Suggested change

package core.basesyntax;

public interface AreaCalculator {
double area();

Choose a reason for hiding this comment

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

Suggested change
double area();
double getArea();

Choose a reason for hiding this comment

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

not fixed

package core.basesyntax;

public interface Drawable {

Choose a reason for hiding this comment

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

Suggested change

private Color color;

public Figure(Color color) {

Choose a reason for hiding this comment

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

Suggested change

}

public Color getColor() {

Choose a reason for hiding this comment

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

Suggested change

switch (type) {
case 0:
return new Square(
random.nextInt(MAX_DIMENSION) + 1,

Choose a reason for hiding this comment

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

create separate method for getting random.nextInt(MAX_DIMENSION) + 1

Figure[] figures = new Figure[FIGURE_COUNT];


for (int i = 0; i < 3; i++) {

Choose a reason for hiding this comment

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

fix comment


@Override
public double area() {

Choose a reason for hiding this comment

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

Suggested change


@Override
public double area() {

Choose a reason for hiding this comment

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

Suggested change


@Override
public double area() {

Choose a reason for hiding this comment

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

Suggested change

Copy link

@liliia-ponomarenko liliia-ponomarenko left a comment

Choose a reason for hiding this comment

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

Let’s fix all previous comments ;)

package core.basesyntax;

public interface AreaCalculator {
double area();

Choose a reason for hiding this comment

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

not fixed

Comment on lines +15 to +20

@Override
public abstract double area();

@Override
public abstract void draw();

Choose a reason for hiding this comment

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

not fixed

getRandomDimension(),
color);
default:
return null;

Choose a reason for hiding this comment

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

don't return null from the method. Use some figures for the default case

+ height + " units, color: " + getColor());
}
}

Choose a reason for hiding this comment

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

leave only one empty line at the end of the file (check other file)

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