import java.util.Scanner; public class Calculator { static String exit = "ÐавеÑÑиÑÑ"; // ÐÑÐ½ÐµÑ Ð² ÑÑаÑиÑеÑкÑÑ ÐºÐ¾Ð½ÑÑанÑÑ "ÐавеÑÑиÑÑ" public static void calc(int people) { String dish; String allDishes = ""; float price; float sumOfOrder = 0.0f; String close; while (true) { Scanner scSecond = new Scanner(System.in); // ÐÑÑавил один ÑÐºÐ°Ð½Ð½ÐµÑ System.out.println("ÐведиÑе название блÑда!"); dish = scSecond.nextLine(); System.out.println("ÐведиÑе ÑÑоимоÑÑÑ ÑÑого блÑда в ÑоÑмаÑе 'ÑÑб.коп'"); if (scSecond.hasNextFloat()) { price = scSecond.nextFloat(); if (price > 0) { sumOfOrder = sumOfOrder + price; allDishes = allDishes + dish + "\n"; String sufForOne = Finish.finish(price); String anotherOne = "ÐÑ Ð´Ð¾Ð±Ð°Ð²Ð¸Ð»Ð¸: %s за %.2f%s\n"; System.out.printf(anotherOne, dish, price, sufForOne); System.out.println("ХоÑиÑе добавиÑÑ Ð±Ð»Ñдо? ÐведиÑе лÑбÑÑ Ð±ÑÐºÐ²Ñ Ð¸Ð»Ð¸ напиÑиÑе:'ÐавеÑÑиÑÑ', еÑли блÑд болÑÑе не оÑÑалоÑÑ"); close = scSecond.next(); if (close.equalsIgnoreCase(exit)) { break; } } else { System.out.println("СÑмма Ñказана невеÑно"); } } else { System.out.println("СÑмма Ñказана невеÑно, попÑобÑйÑе внеÑÑи блÑдо Ñнова"); } } String suf = Finish.finish(sumOfOrder); float forThePerson = sumOfOrder / people; String lastSuf = Finish.finish(forThePerson); System.out.println("ÐÑ ÐºÑпили:\n" + allDishes + "Ðа " + String.format("%.2f", sumOfOrder) + suf); System.out.println("ÐаждÑй должен заплаÑиÑÑ Ð¿Ð¾: " + String.format("%.2f", forThePerson) + lastSuf); } }