import java.util.InputMismatchException; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int peopleCount = 0; while (peopleCount <= 1) { try { System.out.println("Ðа ÑколÑко Ñеловек бÑдем делиÑÑ ÑÑеÑ?"); peopleCount = scanner.nextInt(); if (peopleCount <= 1) { System.out.println("ÐекоÑÑекÑное знаÑение, должно бÑÑÑ Ð±Ð¾Ð»ÑÑе одного гоÑÑÑ! ÐопÑобÑйÑе еÑе."); } else if (peopleCount > 1) { break; } } catch (InputMismatchException e) { System.out.println("ÐекоÑÑекÑное знаÑение, нÑжно ввеÑÑи колиÑеÑÑво гоÑÑей"); scanner.nextLine(); } } Calculator calculator = new Calculator(); calculator.calculate(peopleCount); System.out.println(calculator.listProduct + "\n" + Formater.format(calculator.sumForGuest)); scanner.close(); } }