@@ -0,0 +1,2147 @@
+import java.io.*;%0Aimport java.util.*;%0A%0Apublic class Solution %7B%0A%0A    /**%0A     * libraryFine: function for computing library fine given two dates%0A     */%0A    public static int libraryFine(int%5B%5D expDate, int%5B%5D retDate) %7B%0A        int day = 0, month = 1, year = 2, fine = 0;%0A        final int YEARFINE = 10000, MONTHFINE = 500, DAYFINE = 15;%0A        int monthDiff = retDate%5Bmonth%5D - expDate%5Bmonth%5D;%0A        int dayDiff = retDate%5Bday%5D - expDate%5Bday%5D;%0A%0A        // 4. If the book is not returned in the same year, the fine is fixed at 10000 Hackos.%0A        if(retDate%5Byear%5D %3E expDate%5Byear%5D)%7B%0A            fine = YEARFINE;%0A        %7D%0A        else if(retDate%5Byear%5D == expDate%5Byear%5D) %7B%0A            // 3. If the book is not returned in the same month but in the same year as the expected return date, %0A            //    Fine = 500 Hackos    Number of late months%0A            if (retDate%5Bmonth%5D %3E expDate%5Bmonth%5D) %7B%0A                fine = monthDiff * MONTHFINE;%0A            %7D%0A            // 2. If the book is returned in the same month as the expected return date, %0A            //    Fine = 15 Hackos %C3%97 Number of late days  %0A            else if (retDate%5Bday%5D %3E expDate%5Bday%5D && retDate%5Bmonth%5D == expDate%5Bmonth%5D)%7B%0A                fine = dayDiff * DAYFINE;%0A            %7D%0A        %7D%0A%0A        // 1. If the book is returned on or before the expected return date, no fine will be charged, %0A        //    in other words fine is 0.%0A        return fine;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */%0A%0A        Scanner in = new Scanner(System.in);%0A%0A        final int NUMDATEFIELDS = 3; // 1.month 2.day 3.year%0A%0A        int%5B%5D expDate = new int%5BNUMDATEFIELDS%5D;%0A        int%5B%5D retDate = new int%5BNUMDATEFIELDS%5D;%0A%0A        //get the expected return date%0A        for (int i = 0; i %3C NUMDATEFIELDS; i++) %7B%0A            retDate%5Bi%5D = in.nextInt();%0A        %7D%0A        //get the actual return date%0A        for (int i = 0; i %3C NUMDATEFIELDS; i++) %7B%0A            expDate%5Bi%5D = in.nextInt();%0A        %7D%0A        System.out.println(libraryFine(expDate, retDate));%0A%0A    %7D%0A%7D%0A

Create LibraryFine.java