import java.util.Scanner; public class Auto { String name; double speed; private double MAX_SPEED = 250.; public Auto(String name, double speed) { this.name = name; this.speed = speed; } public Auto(){ this.name = "name"; this.speed = 0; } public void input(){ nameInput(); speedInput(); } private void nameInput(){ System.out.println("ÐведиÑе название авÑомобилÑ:"); Scanner scanner = new Scanner(System.in); this.name = scanner.nextLine(); } private void speedInput(){ Scanner scanner = new Scanner(System.in); while (true) { System.out.println("ÐведиÑе ÑкоÑоÑÑÑ Ð°Ð²ÑÐ¾Ð¼Ð¾Ð±Ð¸Ð»Ñ " + this.name + " в км/Ñ:" ); if (!scanner.hasNextDouble()) { System.out.println("ÐÑ Ð²Ð²ÐµÐ»Ð¸ не ÑиÑло!!! повÑоÑиÑе ввод!!!\n\n"); String temp= scanner.next(); } else { this.speed = scanner.nextDouble(); if ((this.speed > 0.) && (this.speed < MAX_SPEED)) { break; } else { System.out.println("ÐекоÑÑекÑное знаÑение ÑкоÑоÑÑи, повÑоÑиÑе ввод!!!\n\n"); } } } } public void print(){ System.out.println("ÐвÑÐ¾Ð¼Ð¾Ð±Ð¸Ð»Ñ " +this.name+ " Ñо ÑкоÑоÑÑÑÑ " + this.speed+ " км/Ñ;"); } }