diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..962e712
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+Java-Module-Project
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..7643783
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..79ee123
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..61a9130
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..6cec569
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..64298bb
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/Calculate.java b/src/main/java/Calculate.java
new file mode 100644
index 0000000..7f38391
--- /dev/null
+++ b/src/main/java/Calculate.java
@@ -0,0 +1,60 @@
+import java.util.Scanner;
+
+public class Calculate {
+
+ public static void product(double person) {
+
+ String food = "";
+ double price = 0.0;
+
+ while (true) {
+ System.out.println("Для добавления товара введите название продукта\nДля завершения программы введите \"Завершить\"");
+ Scanner scanner = new Scanner(System.in);
+ String inputFood = scanner.next();
+ double itog = 0;
+
+ if (inputFood.equalsIgnoreCase("Завершить")) {
+ itog = (int) (price / person);
+ System.out.println("Покупка завершена, " + String.format("%.0f", person) + " персоны заплатят по " + itog + " " + Matsh.floover(itog));
+ break;
+
+ } else {
+ System.out.println("Введите стоимость продукта в формате \"'рубли.копейки' [10.45, 11.40]\"");
+ while (!scanner.hasNextInt()) {
+ System.out.println("Некорректное значение, введите стоимость продукта в формате \"'рубли.копейки' [10.45, 11.40]\"");
+ scanner.next();
+ }
+ float inputPrice = (float) scanner.nextDouble();
+ food = food + "\n" + inputFood;
+ price = price + inputPrice;
+
+ System.out.println("Вы успешно добавили продукт:" + food + "\nИтог: " + String.format("%.2f", price) + " " + Matsh.floover(itog));
+ }
+ }
+ }
+
+static class Matsh {
+
+ public static String floover(double price) {
+
+ int amount = (int) price;
+
+ if (amount> 100)
+ amount %= 100;
+
+ if (amount> 20)
+ amount %= 10;
+
+ switch (amount) {
+ case 1:
+ return "Рублю";
+ case 2:
+ case 3:
+ case 4:
+ return "Рубля";
+ default:
+ return "Рублей";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Main.java b/src/main/java/Main.java
deleted file mode 100644
index a9198c4..0000000
--- a/src/main/java/Main.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- // ваш код начнется здесь
- // вы не должны ограничиваться только классом Main и можете создавать свои классы по необходимости
- System.out.println("Привет Мир");
- }
-}
diff --git a/src/main/java/Menu.java b/src/main/java/Menu.java
new file mode 100644
index 0000000..86b6c0f
--- /dev/null
+++ b/src/main/java/Menu.java
@@ -0,0 +1,34 @@
+import java.util.Scanner;
+
+public class Menu {
+ public static void main(String[] args) {
+inputParameters();
+
+ }
+ public static void inputParameters(){
+ Scanner scanner = new Scanner(System.in);
+ System.out.println("На сколько персон делить чек?");
+ int person = 0;
+
+ while (!scanner.hasNextInt()) {
+ System.out.println("Некорректное значение для подсчёта, попробуйте еще раз");
+ scanner.next();
+ }
+ while (true) {
+ person = scanner.nextInt();
+ if (person> 1) {
+ System.out.println("Давайте посчитаем!");
+ Calculate.product(person);
+ }
+ if (person == 1) {
+ System.out.println("Вы оплачиваете счет сами");
+ Calculate.product(person);
+ }
+ if (person < 1) {
+ System.out.println("Некорректное значение для подсчёта, попробуйте еще раз");
+
+
+ }
+ }
+ }
+}
\ No newline at end of file