import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); short participantsQuantity = 0; String breakDeÑision = "ÐавеÑÑиÑÑ"; while (participantsQuantity <= 1) { System.out.println("Ðа ÑколÑÐºÐ¸Ñ Ñеловек Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑазделиÑÑ ÑÑеÑ?"); if (scanner.hasNextShort()) { participantsQuantity = scanner.nextShort(); } else { scanner.next(); } if (participantsQuantity <= 1) { System.out.println("ÐолиÑеÑÑво ÑÑаÑÑников дожно бÑÑÑ ÑиÑло болÑÑе 1"); } } Calculator calc = new Calculator(participantsQuantity); String userDeÑision = ""; while (!userDeÑision.equalsIgnoreCase(breakDeÑision)) { System.out.println("ÐведиÑе название ÑоваÑа (ÑÑб,коп)"); String product = scanner.next(); float cost = 0f; while (cost <= 0) { System.out.println("ÐведиÑе ÑÑоимоÑÑÑ"); if (scanner.hasNextFloat()) { cost = scanner.nextFloat(); } else { scanner.next(); } if (cost <= 0) { System.out.println("СmоимоÑÑÑ ÑоваÑа должно бÑÑÑ ÑиÑло болÑÑе нÑлÑ!"); } } calc.addProduct(product, cost); System.out.println("ÐобавиÑÑ ÐµÑÑ Ð¾Ð´Ð¸Ð½ ÑоваÑ? (ÐÑли ÑÑо вÑÑ, введиÑе \"" + breakDeÑision + "\")"); userDeÑision = scanner.next(); } calc.calculate(); } }