aboutsummaryrefslogtreecommitdiff
path: root/Practical2/src/nl/camilstaps/cs/Main.java
blob: 2009c4d7f8dd37732a697b94036eea41ec0e16a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package nl.camilstaps.cs;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    CheckoutHelper ch = new CheckoutHelper();
        int n_dividers = readCheckoutHelper(new Scanner(System.in), ch);
        System.out.println(ch.minimumPayment(n_dividers));
    }

    private static int readCheckoutHelper(Scanner sc, CheckoutHelper ch) {
        int n_products = sc.nextInt();
        int n_dividers = sc.nextInt();

        for (int i = 0; i < n_products; i++)
            ch.addProduct(sc.nextInt());

        return n_dividers;
    }

}