Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Yandex-Practicum/Java-Module-Project-YP
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dev
Choose a base ref
...
head repository: Ilshatissimo/Java-Module-Project-YP
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dev
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 5 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 3, 2026

  1. Ильшат

    Ilshatissimo committed Aug 3, 2026
    Configuration menu
    Copy the full SHA
    0906c98 View commit details
    Browse the repository at this point in the history
  2. Ilshat

    Ilshatissimo committed Aug 3, 2026
    Configuration menu
    Copy the full SHA
    0715e3b View commit details
    Browse the repository at this point in the history
  3. Ilshat

    Ilshatissimo committed Aug 3, 2026
    Configuration menu
    Copy the full SHA
    9b8072a View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2026

  1. Configuration menu
    Copy the full SHA
    5bee710 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2026

  1. package org.example;

    import java.util.Scanner;
    
    public class Main {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            Race race = new Race();
    
            for (int i = 1; i <= 3; i++) {
                String name = "";
                while (true) {
                    System.out.print("— Введите название машины №" + i + ": ");
                    name = scanner.nextLine();
                    if (!name.trim().isEmpty()) {
                        break;
                    } else {
                        System.out.println("— Ошибка: Название автомобиля не может быть пустым");
                    }
                }
    
                int speed = 0;
                while (true) {
                    System.out.print("— Введите скорость машины №" + i + ": ");
                    String speedInput = scanner.nextLine();
    
                    if (speedInput.trim().isEmpty()) {
                        System.out.println("— Неправильная скорость");
                        continue;
                    }
    
                    try {
                        speed = Integer.parseInt(speedInput);
    
                        if (speed > 0 && speed <= 250) {
                            break;
                        } else {
                            System.out.println("— Неправильная скорость");
                        }
                    } catch (NumberFormatException e) {
                        System.out.println("— Неправильная скорость");
                    }
                }
    
                Car car = new Car(name, speed);
                race.checkNewParticipant(car);
            }
    
            race.printLeader();
        }
    }
    
    class Car {
        String name;
        int speed;
    
        public Car(String name, int speed) {
            this.name = name;
            this.speed = speed;
        }
    }
    
    class Race {
        String leaderName = "";
        int maxDistance = 0;
    
        public void checkNewParticipant(Car car) {
            int distance = car.speed * 24;
    
            if (distance > maxDistance) {
                maxDistance = distance;
                leaderName = car.name;
            }
        }
    
        public void printLeader() {
            System.out.println("Самая быстрая машина: " + leaderName);
        }
    }
    Ilshatissimo committed Sep 15, 2026
    Configuration menu
    Copy the full SHA
    828626e View commit details
    Browse the repository at this point in the history
Loading