public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Podaj ilość produktów: ");
        int ilosc = scanner.nextInt();

        double suma0 = 0, suma7 = 0, suma23 = 0;
        for (int i = 1; i <= ilosc; i++) {

            int kod = -1;

            while (kod < 0 || kod > 2) {
                System.out.println("Podaj kod produktu " + i
                        + "(0[0% VAT], 1[7% VAT], 2[23% VAT): ");
                kod = scanner.nextInt();
                if (kod < 0 || kod > 2) System.out.println("Bledny kod produktu");
            }

            System.out.print("Podaj cenę produktu " + i + ": ");
            double cena = scanner.nextDouble();
            if (kod == 0) {
                suma0 = suma0 + cena;
            } else if (kod == 1) {
                suma7 = suma7 + cena;
            } else {
                suma23 = suma23 + cena;
            }
        }

        double sumaVAT0, sumaVAT7, sumaVAT23, kosztCalkowity, VATCalkowity;

        kosztCalkowity = suma0 + suma7 + suma23;
        sumaVAT0 = 0;
        sumaVAT7 = suma7 / 100 * 7;
        sumaVAT23 = suma23 / 100 * 23;
        VATCalkowity = sumaVAT0 + sumaVAT7 + sumaVAT23;

        System.out
                .println("-----------------------------------------------------------------------------------------");
        System.out.println("Zatem podliczmy koszty...");
        System.out
                .println("-----------------------------------------------------------------------------------------");
        System.out.println("A) Koszt produktów z VAT 23%: " + suma23 + "          W tym sam VAT: "
                + sumaVAT23);
        System.out.println("B) Koszt produktów z VAT 7%: " + suma7 + "           W tym sam VAT: "
                + sumaVAT7);
        System.out.println("C) Koszt produktów z VAT 0%: " + suma0 + "           W tym sam VAT: "
                + sumaVAT0);
        System.out
                .println("-----------------------------------------------------------------------------------------");
        System.out.println("                       suma: " + kosztCalkowity
                + "                    suma: " + VATCalkowity);

    }