forked from Yandex-Practicum/Java-Module-Project-YP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
32 lines (27 loc) · 1.41 KB
/
Main.java
File metadata and controls
32 lines (27 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import Controllers.BufferReaderController;
import builders.BillBuilder;
import builders.ProductBuilder;
import models.Bill;
import tools.Calculator;
public class Main {
public static void main(String[] args) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
BufferReaderController controller = new BufferReaderController(reader);
Bill bill = BillBuilder.makeBill(controller);
do {
bill.addProduct(ProductBuilder.makeProduct(controller));
System.out.println("Товар добавлен.");
System.out.println(
"Если вы хотите продолжить добавление продуктов, введите любой символ."
+ System.lineSeparator()
+ "Для завершения ввода введите \"Завершить\"");
} while (!controller.getString().equalsIgnoreCase("завершить"));
Calculator.countBill(bill);
} catch (IOException e) {
System.out.println("Вмешались неведомые силы и что-то пошло не так. Попробуйте запустить приложение ещё раз.");
}
}
}