Skip to content

Conversation

@AskarSabirov
Copy link
Owner

No description provided.

Choose a reason for hiding this comment

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

Рекомендация: файлы директорий .idea и build стоит вынести в .gitignore


for (int i = 1; i <= 3; i++) {
System.out.println("Введите название машины №" + i + ": ");
Car.car = scanner.next();

Choose a reason for hiding this comment

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

Здесь нужно создавать ноdый экземпляр класса : Car car = new Car(name, speed)

while (true) {
System.out.println("Введите скорость машины №" + i + ": ");
Car.speed = scanner.nextInt();
if ((Car.speed >= 0) & (Car.speed <= 250)) {

Choose a reason for hiding this comment

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

Критично: & - это побитовое И, здесь нужно логическое &&



public static void nowLead(Car car) {
int distance = Car.speed * 24;

Choose a reason for hiding this comment

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

здесь по сути идет проверка только по последней введенной скорости. Нужно взять 3 экземпляра авто(списком), пройтись по ним циклом и определить победителя

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