Menu
Question Index
...


Write a program to get the common working day between Dubai and US. Given that Dubai does not work on Thursday and Friday and the US does not on Saturday and Sunday. The list of other holidays are also given.

Input (String, int, List, List) Output (String)
12-Nov-1947, 366, [10-Feb-1947, 05-May-1947, 06-May-1947, 11-May-1948, 12-Oct-1948, 24-Dec-1948] and [11-Feb-1947, 01-May-1947, 15-Oct-1948, 15-Nov-1948, 28-Nov-1948, 27-Dec-1948] 16-Nov-1948
01-Apr-2000, 19, [14-Feb-2000, 24-Apr-2000, 03-Oct-2000, 25-Dec-2000, 26-Dec-2000] and [07-Feb-2000, 08-Feb-2000, 09-Feb-2000, 25-Apr-2000, 02-Oct-2000, 04-Oct-2000] 26-Apr-2000
1-Feb-2000, 2, [14-Feb-2000, 24-Apr-2000, 03-Oct-2000, 25-Dec-2000, 26-Dec-2000] and [07-Feb-2000, 08-Feb-2000, 09-Feb-2000, 25-Apr-2000, 02-Oct-2000, 04-Oct-2000] 15-Feb-2000
25-Oct-2000, 60, [14-Feb-2000, 24-Apr-2000, 03-Oct-2000, 25-Dec-2000, 26-Dec-2000] and [07-Feb-2000, 08-Feb-2000, 09-Feb-2000, 25-Apr-2000, 02-Oct-2000, 04-Oct-2000] 27-Dec-2000
23-Dec-2014, 365, [23-Oct-2014, 25-Dec-2014, 01-Apr-2015, 20-Aug-2015] and [01-Jan-2014, 11-Mar-2014, 24-Nov-2014, 23-Dec-2015] 28-Dec-2015
30-Mar-2015, 143, [23-Oct-2014, 25-Dec-2014, 01-Apr-2015, 20-Aug-2015] and [01-Jan-2014, 11-Mar-2014, 24-Nov-2014, 23-Dec-2015] 24-Aug-2015

class GetCommonWorkingDayAdvanced

{    public static void main(String s[])
    {
        String currentWorkingDay = "22-Jan-2013";
        int findAfter = 1;
        List holidaysUS = new ArrayList();
        holidaysUS.add("01-Jan-2013");
        holidaysUS.add("13-Jan-2013");
        holidaysUS.add("01-Feb-2013");
        holidaysUS.add("29-Mar-2013");
        holidaysUS.add("12-May-2013");
        holidaysUS.add("04-Jul-2013");
        holidaysUS.add("02-Sep-2013");
        holidaysUS.add("03-Nov-2013");
        holidaysUS.add("25-Dec-2013");
        List holidaysDubai = new ArrayList();
        holidaysDubai.add("01-Jan-2013");
        holidaysDubai.add("24-Jan-2013");
        holidaysDubai.add("06-Jun-2013");
        holidaysDubai.add("09-Jul-2013");
        holidaysDubai.add("08-Aug-2013");
        holidaysDubai.add("14-Oct-2013");
        holidaysDubai.add("04-Nov-2013");
        holidaysDubai.add("02-Dec-2013");
        holidaysDubai.add("03-Dec-2013");
        String commonWorkingDayIs = getCommonWorkingDay(currentWorkingDay, findAfter, holidaysUS, holidaysDubai);
        System.out.println("Common working day after " + findAfter + " days from " + currentWorkingDay + " is " + commonWorkingDayIs);

    }


public static String getCommonWorkingDay(String startingDate, int findAfter, List<String> holidaysUS, List<String> holidaysDubai) {
//Write code here to get the common working day
return commonWorkingDay;
}
}

Doubts

Problems

Topic: Locale Class In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App