forked from Yandex-Practicum/Java-Module-Project-YP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResultViewer.java
More file actions
15 lines (13 loc) · 889 Bytes
/
ResultViewer.java
File metadata and controls
15 lines (13 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public class ResultViewer {
public void viewResult(ItemsList itemsList, double moneyPerPerson, int peopleAmount) {
Formatter formatter = new Formatter();
double sum = moneyPerPerson * peopleAmount;
System.out.println("Добавленные товары:");
for (int i = 0; i < itemsList.names.size(); i = i + 1) {
System.out.println(itemsList.names.get(i).name + " " + itemsList.names.get(i).price + " " + formatter.makeRightCase(itemsList.names.get(i).price));
}
System.out.println("Общая сумма счета: " + String.format("%.2f", sum) + " " + formatter.makeRightCase(sum));
System.out.println("Делим на " + peopleAmount + "-х.");
System.out.println("Итого с каждого по " + String.format("%.2f", moneyPerPerson) + " " + formatter.makeRightCase(moneyPerPerson));
}
}