Skip to content

Homework 2_2 is done#8

Open
ushki92 wants to merge 1 commit into
masterfrom
Lesson2_2
Open

Homework 2_2 is done#8
ushki92 wants to merge 1 commit into
masterfrom
Lesson2_2

Conversation

@ushki92

@ushki92 ushki92 commented Oct 14, 2021

Copy link
Copy Markdown
Owner

No description provided.

@DisterDE DisterDE left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Следует доработать.

}
vehicles.checkEngine();
vehicles.checkTrailer();}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

У машины нет трейлера.


public class Car extends Vehicles{

protected Car(String modelName, int wheelsCount) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Зачем protected?

}

@Override
protected void check(Vehicles vehicles) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Зачем protected?

public class Main {
public static void main(String[] args) {

Vehicles[] vehicles = new Vehicles[] {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тип должен иметь единственное число, т.е. Vehicle

Comment on lines +16 to +18
for (int i = 0; i < vehicles.length; i++) {
vehicles[i].check(vehicles[i]);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Следует заменить на foreach.

А где сама сервисная станция?
Почему мы вызываем у объекта Vehicle метод, который требует подачи себя же в качестве параметра?

Comment on lines +10 to +16
public void check(Vehicles vehicles){System.out.println("Обслуживаем2 " + vehicles.getModelName());
for (int i = 0; i < vehicles.getWheelsCount(); i++) {
vehicles.updateTyre();
}
vehicles.checkEngine();
vehicles.checkTrailer();}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Этот код общий с машиной, следовательно нужно как-то это решить.

Comment on lines +35 to +41
public void checkEngine() {
System.out.println("Проверяем двигатель");
}

public void checkTrailer() {
System.out.println("Проверяем прицеп");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

У велосипеда нет этих двух методов, а у машины нет трейлера.

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.

2 participants