import java.util.Scanner; public class Main { public static void main(String[] args) { int people; String rubles; while (true) { Scanner scanner = new Scanner(System.in); System.out.println("СколÑко ÐÐ°Ñ Ñеловек"); if (scanner.hasNextInt()) { people = scanner.nextInt(); if (people == 1) { System.out.println("ÐÐµÑ ÑмÑÑла ÑÑиÑаÑÑ, Ð´Ð»Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ Ñеловека"); } if (people <= 0){ System.out.println("ÐекоÑÑекÑное знаÑение"); } if (people > 1) { break; } } else { System.out.println("ÐекоÑÑекÑное знаÑение"); } } Calculator calculate = new Calculator(); calculate.counting(); if (Math.floor(calculate.cost / people) == 1) { rubles = "ÑÑблÑ"; } else if (calculate.cost / people >= 2 && calculate.cost / people < 5) { rubles = "ÑÑблÑ"; } else { rubles = "ÑÑблей"; } String str = String.format(calculate.productList + '\n' + "ÐÑÐ¾Ð³Ð¾Ð²Ð°Ñ ÑÑоимоÑÑÑ Ð²ÑÐµÑ Ð¿ÑодÑкÑов %.2f" + '\n' + "ÐаждÑй заплаÑÐ¸Ñ %.2f " + rubles, calculate.cost, calculate.cost/people ); System.out.println(str); } }