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 model; while (true) { System.out.println("ÐÑбеÑиÑе маÑÐºÑ " + i + " авÑомобилÑ"); model = scanner.nextLine(); if (model.trim().isEmpty()) { System.out.println("ÐевеÑÐ½Ð°Ñ Ð¼Ð°Ñка авÑомобилÑ"); } else { break; } } int speed; final int maxSpeed = 250; final int minSpeed = 0; while (true) { try { System.out.println("УкажиÑе макÑималÑнÑÑ ÑкоÑоÑÑÑ " + i + " авÑомобилÑ"); speed = Integer.parseInt(scanner.nextLine()); if (speed > maxSpeed || minSpeed > speed) { throw new Exception(); } else { break; } } catch (Exception ex) { System.out.println("ÐевеÑÐ½Ð°Ñ ÑкоÑоÑÑÑ"); } } Car car = new Car(model, speed); race.race(car.model, car.speed); } System.out.println("СамÑй бÑÑÑÑÑй авÑомобилÑ: " + race.vinner); } }