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
28 lines (20 loc) · 1.01 KB
/
Main.java
File metadata and controls
28 lines (20 loc) · 1.01 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
import java.util.*;
public class Main {
public static void main(String[] args) {
int persons = BillCalculator.amountRequest();
HashMap<ArrayList<String>, Float> finalProductMap = BillCalculator.calculator();
Map.Entry<ArrayList<String>, Float> entry = finalProductMap.entrySet().iterator().next();
ArrayList<String> products = entry.getKey();
float totalPaid = entry.getValue();
System.out.println("--------------------");
System.out.println("Добавленные товары:");
for (String element : products) {
System.out.println(element);
}
System.out.println("--------------------");
float payForPerson = totalPaid / persons;
System.out.printf("Сумма, которую должен заплатить каждый человек, составляет %.2f рубл%s.\n", payForPerson,
BillCalculator.properTextEnd(payForPerson));
System.out.println("--------------------");
}
}