import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Ðа ÑколÑÐºÐ¸Ñ Ñеловек Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑазделиÑÑ ÑÑÑÑ?"); while (!scanner.hasNextInt()){ // ÐÑовеÑÑем, ввели ли знаÑение Ñипа int scanner.next(); System.out.println("ÐÑ Ð²Ð²ÐµÐ»Ð¸ невеÑное знаÑение, попÑобÑйÑе еÑе Ñаз: "); } int amountOfPersons = scanner.nextInt(); while (amountOfPersons < 2) { // еÑли знаÑенние 0,1 или оÑÑиÑаÑелÑное, запÑаÑиваем ввод Ñнова System.out.println("Ð Ñаком ÑлÑÑае Ð½ÐµÑ ÑмÑÑла ÑÑиÑаÑÑ :\nÐведиÑе знаÑение еÑе Ñаз: "); while (!scanner.hasNextInt()) { scanner.next(); } amountOfPersons = scanner.nextInt(); } System.out.println("Ðол-во пеÑÑон: " + amountOfPersons); Product products = new Product(); products.saveProducts(); Calculator calculator = new Calculator(); calculator.calculate(amountOfPersons, products.totalSumOfProducts); calculator.correctOutput(); } }