forked from Yandex-Practicum/Java-Module-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
23 lines (20 loc) · 877 Bytes
/
Main.java
File metadata and controls
23 lines (20 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.ArrayList;
public class Main {
static ArrayList<String> goodsArray = new ArrayList<>(); //Массив товаров
static ArrayList<Double> pricesArray = new ArrayList<>(); //Массив цен
public static void main(String[] args) {
int qtyOfGuys, qtyOfGoods;
int i = 0;
double sum = 0;
qtyOfGuys = howManyGuys.howManyGuys();
qtyOfGoods = goodsEntering.goodsArrayCreating();
System.out.println("\nДОБАВЛЕННЫЕ ТОВАРЫ: ");
while (i < qtyOfGoods){
System.out.println((i+1) + ") " + goodsArray.get(i));
sum += pricesArray.get(i);
i++;
}
double payment = (double) sum / qtyOfGuys;
System.out.println("С каждого участника по " + String.format("%.2f", payment) + rubWord.rubWord(payment));
}
}