import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double sum = 0.0; String people; String allProducts = ""; System.out.println("Ðа ÑколÑÐºÐ¸Ñ Ñеловек Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑазделиÑÑ ÑÑÑÑ?"); while (true) { people = scanner.nextLine(); if (Formatter.checksForInput(people)) { break; } } while (true) { allProducts += Calculator.processProducts() + "\n"; sum += Calculator.receiveTheCostOfTheProduct() ; System.out.println("Ð¢Ð¾Ð²Ð°Ñ ÑÑпеÑно добавлен.\nÐапиÑиÑе \"Ðа\", ÑÑÐ¾Ð±Ñ Ð¿ÑодолжиÑÑ Ð¸Ð»Ð¸ \"ÐавеÑÑиÑÑ\", ÑÑÐ¾Ð±Ñ Ð·Ð°ÐºÑÑÑÑ Ð¿ÑогÑаммÑ. "); String answer = scanner.next(); if (answer.equalsIgnoreCase("ÐавеÑÑиÑÑ")) { break; } } double priceForOnePerson = (int)sum / Integer.parseInt(people); String format = "ÐаждÑй Ñеловек должен заплаÑиÑÑ %.2f "; System.out.println("ÐобавленнÑе ÑоваÑÑ:" + "\n" + allProducts); System.out.println(String.format(format, priceForOnePerson) + Formatter.GetDeclinationRub((int) Math.floor(priceForOnePerson))); } }