import java.util.Scanner; public class Race { int time = 24; Scanner scanner; int speed; String name; public Race() { scanner = new Scanner(System.in); speed = 0; name = null; } public void getWinner(int[] arrayI, String[] arrayS) { int[] s = new int[3]; int max = 0; int num = -1; for(int i =0; i<3; i++) { s[i] = time* arrayI[i]; } for(int i = 0; i<3;i++) { if(s[i]>max) { max = s[i]; num += 1; } } if(max == s[0] & max == s[1] || max == s[1] & max == s[2] || max == s[0] & max == s[2] || max == s[0] & max == s[1] & max == s[2]) { System.out.println("ÐобедиÑелей неÑ!"); } else { System.out.println("Ð¡Ð°Ð¼Ð°Ñ Ð±ÑÑÑÑÐ°Ñ Ð¼Ð°Ñина: " + arrayS[num]); } } public void setCar() { System.out.println("Ðазввание: "); name = scanner.nextLine(); System.out.println("СкоÑоÑÑÑ: "); while(!scanner.hasNextInt()) { scanner.next(); System.out.println("СкоÑоÑÑÑ Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð²ÑÑажена ÑолÑко ÑелÑм ÑиÑлом, попÑобÑйÑе еÑÑ Ñаз: "); } speed = scanner.nextInt(); if (!(speed > 0 & speed <= 250)) { while(!(speed > 0 & speed <= 250)) { System.out.println("СкоÑоÑÑÑ Ð´Ð¾Ð»Ð¶Ð½Ð° бÑÑÑ Ð±Ð¾Ð»ÑÑе 0 и менÑÑе 250, попÑобÑйÑе ÑказаÑÑ ÐµÑ ÐµÑÑ Ñаз:"); while(!scanner.hasNextInt()) { scanner.next(); System.out.println("СкоÑоÑÑÑ Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð²ÑÑажена ÑолÑко ÑелÑм ÑиÑлом, попÑобÑйÑе еÑÑ Ñаз: "); } speed = scanner.nextInt(); } } } public String returnName() { return this.name; } public int returnSpeed() { return this.speed; } }