import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner scanner = new Scanner(System.in); int numberOfGuests; while (true) { System.out.println("Ðа ÑколÑÐºÐ¸Ñ Ñеловек Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑазделиÑÑ ÑÑÑÑ?"); if (scanner.hasNextInt()) { numberOfGuests = scanner.nextInt(); if (numberOfGuests == 1) { System.out.println("ÐÐµÑ ÑмÑÑла делиÑÑ, Ð²Ñ Ð¿ÑиÑли одни. ÐовÑоÑиÑе попÑÑкÑ."); } else if (numberOfGuests < 1) { System.out.println("ÐекоÑÑекÑное знаÑение Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑеÑа. ÐовÑоÑиÑе попÑÑкÑ."); } else { break; } } else { System.out.println("Ðведено не ÑиÑло. ÐовÑоÑиÑе попÑÑкÑ."); scanner.next(); } } Calculator calculator = new Calculator(); calculator.makeBasketProducts(); double totalCost = calculator.getTotalCost(); double costPerGuest = Math.round(totalCost / numberOfGuests * 100.0) / 100.0; String formattedTotalCost = Formatter.formatTotalCost(costPerGuest); System.out.println("ÐаждÑй гоÑÑÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ заплаÑиÑÑ: " + formattedTotalCost); } }