Menu
Question Index
...


Write a program to identify an half hour slot for two employees which they can use for meeting.
The time slot returned should be in first employee's time zone. If there is no common time slot return null.

Input (Employee, Employee) Output (String)
First : Mahesh EST [07:00 - 11:00, 13:00 - 15:30]
Second : Srinath GMT [07:00 - 11:00, 13:00 - 15:30]
08:00 - 08:30
First : Sona IST [06:00 - 08:00, 13:00 - 14:30, 17:00 - 21:30]
Second : Mona GMT [07:00 - 07:30, 13:00 - 14:00, 18:00 - 19:00]
18:30 - 19:00
First : Rupa IST [05:00 - 07:00, 13:00 - 18:30]
Second : Radha JST [07:00 - 07:30, 17:00 - 19:00]
13:30 - 14:00
First : Chiranjeevi CST [13:00 - 13:30]
Second : Charan EAT [07:00 - 07:30, 18:00 - 20:00]
null
First : Amulya EDT [07:00 - 07:30, 13:00 - 14:00, 19:00 - 20:00]
Second : Arun SGT [17:00 - 19:00]
null

class CommonHalfHourSlotOfTwoEmployees

{    public static void main(String s[])
    {
        Employee mahesh = new Employee("Mahesh", "EST");
        mahesh.freeTimes.add("07:00 - 11:00");
        mahesh.freeTimes.add("13:00 - 15:30");
        Employee srinath = new Employee("Srinath", "GMT");
        srinath.freeTimes.add("07:00 - 11:00");
        srinath.freeTimes.add("13:00 - 15:30");
        System.out.println("Common half hour slot for Mahesh and Srinath is : " + findCommonHalfHourSlot(mahesh, srinath));

    }


public static String findCommonHalfHourSlot(Employee first, Employee second) {
//Write code here to identify an half hour slot for two employees which they can use for meeting.
return result;
}

//If required write any additional methods here.
}
class Employee {

String name;
String timeZone;
ArrayList<String> freeTimes = new ArrayList<String>();

public Employee(String name, String timeZone) {
this.name = name;
this.timeZone = timeZone;
}
}

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