import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Goods goods = new Goods (); Transformer transform = new Transformer(); System.out.println("УкажиÑе колиÑеÑÑво Ñеловек, на коÑоÑÑÑ Ð½Ñжно ÑазделиÑÑ ÑÑеÑ:"); int countOfPersons = 0; while (true) { if (scanner.hasNextInt()) { countOfPersons = scanner.nextInt(); if (countOfPersons>1){ break; } else { System.out.println("Ðведено некоÑÑекÑное знаÑение. ÐолиÑеÑÑво Ñеловек должно бÑÑÑ Ð±Ð¾Ð»ÑÑе 1."); } } else { scanner.next(); System.out.println("Ðведено некоÑÑекÑное знаÑение. ÐолиÑеÑÑво Ñеловек должно бÑÑÑ Ð²ÑÑажено ÑиÑлом и бÑÑÑ Ð±Ð¾Ð»ÑÑе 1."); } } goods.addGood(scanner); goods.showGoods(); double sum = goods.sum; goods.showPrice(); scanner.close(); String rublesRes = transform.getRublesWordForResult(goods.showResult(sum, countOfPersons)); String resultText = "ÐаждÑй должен заплаÑиÑÑ Ð¿Ð¾ %.2f %s."; System.out.println(String.format(resultText, goods.showResult(sum, countOfPersons), rublesRes)); } }