Skip to content

ПР от Карена#1

Open
Karen927 wants to merge 3 commits into
mainfrom
dev
Open

ПР от Карена#1
Karen927 wants to merge 3 commits into
mainfrom
dev

Conversation

@Karen927

Copy link
Copy Markdown
Owner

Первая курсовая

Comment thread src/main/java/Car.java
Comment on lines +2 to +3
private String name;
private double speed;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Поля лучше пометить final, тем самым исключив возожность их модификации извне. Тогда можно будет сделать поля публичными и удалить геттеры

Comment thread src/main/java/Main.java
Comment thread src/main/java/Race.java
import java.util.List;

public class Race {
private List<Car> cars;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

От хранения массива машин и лишнего цикла при определении победителя можно избавиться, если при вводе данных сразу вычислять победителя и хранить его в отдельной переменной, тогда программа будет требовать меньше памяти и работать быстрее

Copy link
Copy Markdown
Owner Author

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