import java.util.Scanner; public class Rock { Scanner scanner = new Scanner(System.in); int personCheck; float fullPrice; float priceForOne; float price; String product; String fullProduct = "ÐобавленнÑе ÑоваÑÑ: "; String rub = " Ð Ñблей"; public void person() { System.out.println("ÐведиÑе колиÑеÑÑво на ÑколÑко Ñеловек Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑазделиÑÑ ÑÑÑÑ"); while (true) { if (!scanner.hasNextInt()) { System.out.println("ÐведиÑе Ñелое ÑиÑло, а не " + scanner.nextLine()); continue; } else { personCheck = scanner.nextInt(); break; } } } public void morePerson() { while (personCheck <= 1) { System.out.println("ÐекоÑÑекÑное знаÑение, введиÑе ÑиÑло болÑÑе 1"); person(); if (personCheck > 1) { break; } } } void addProduct() { System.out.print("ÐведиÑе название ÑоваÑа: "); product = scanner.nextLine(); product = scanner.nextLine(); System.out.print("ÐведиÑе ÑÑоимоÑÑÑ ÑоваÑа в ÑоÑмаÑе \"ÑÑбли.копейки\": "); price = scanner.nextFloat(); System.out.println("Ð¢Ð¾Ð²Ð°Ñ ÑÑпеÑно добавлен!\n"); fullProduct = fullProduct + "\n" + product ; fullPrice += price; } void addMoreProduct(){ String end = "ÐавеÑÑиÑÑ"; String yes = "Ðа"; while (true) { System.out.println("ХоÑиÑе добавиÑÑ ÐµÑÑ ÑоваÑ?\nÐÐ»Ñ Ð¿ÑÐ¾Ð´Ð¾Ð»Ð¶ÐµÐ½Ð¸Ñ Ð²Ð²ÐµÐ´Ð¸Ñе: " + yes + "\nÐÐ»Ñ Ð·Ð°Ð²ÐµÑÑÐµÐ½Ð¸Ñ Ð²Ð²ÐµÐ´Ð¸Ñе: " + end); product = scanner.nextLine(); product = scanner.nextLine(); // ÑÑо Ð±Ñ Ð½Ðµ пеÑаÑало Ñо ÑÑо вÑÑе 2 Ñаза if (yes.equalsIgnoreCase(product)){ addProduct(); continue; } if (end.equalsIgnoreCase(product)){ System.out.println(fullProduct); String.format("%.2f",fullPrice); System.out.println("СÑмма ÑоваÑов: " + fullPrice); break; } } } public void endCalculator(){ priceForOne = fullPrice / personCheck; if (Math.floor(priceForOne) < 5) { rub = " Ð ÑблÑ"; } String.format("%.2f", priceForOne); System.out.println("СÑмма на Ñеловека: " + priceForOne + rub); } }