public class Calculator { String allNames = ""; double allPrices = 0; String declension(double priceD) { int priceI = (int) Math.floor(priceD); String rubl = " ÑÑблÑ"; String rublya = " ÑÑблÑ"; String rubley = " ÑÑблей"; if (priceI > 100) { priceI %= 100; } if (priceI > 20) { priceI %= 10; } switch (priceI) { case 1: return rubl; case 2: case 3: case 4: return rublya; default: return rubley; } } void add(String name, double price) { allNames = allNames + "\n" + name + " " + String.format("%.2f", price) + declension(price); allPrices += price; System.out.println("Ð¢Ð¾Ð²Ð°Ñ ÑÑпеÑно добавлен!"); } void out() { System.out.println("ÐобавленнÑе ÑоваÑÑ:" + allNames); System.out.println("ÐбÑÐ°Ñ ÑÑоимоÑÑÑ: " + allPrices + declension(allPrices)); } void calculate(int people) { double one = allPrices / people; System.out.println("ÐаждÑй должен заплаÑиÑÑ: " + String.format("%.2f", one) + declension(one)); } }