import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
Scanner scanner = new Scanner(new File("products.txt"));
double total = 0;
int count = 0;
System.out.println("СПИСОК ПОКУПОК");
System.out.println("-------------------------");
while (scanner.hasNextLine())
{
String line = scanner.nextLine();
int position = line.lastIndexOf(" ");
String name = line.substring(0, position);
String priceText = line.substring(position + 1);
double price = Double.parseDouble(priceText);
System.out.println(name + " - " + price + " евро");
total = total + price;
count++;
}
scanner.close();
double average = total / count;
double nds = total * 0.20;
System.out.println("-------------------------");
System.out.println("Количество товаров: " + count);
System.out.println("Общая стоимость: " + total + " евро");
System.out.println("Средняя цена: " + average + " евро");
System.out.println("НДС 20%: " + nds + " евро");
System.out.println("Цена с НДС: " + (total + nds) + " евро");
}
}