Menu
Question Index
...


Write a program to identify a common half hour slot for two employees which they can use for a meeting.
If there is no common time slot return null.

Input (Employee, Employee) Output (String)
First : Mahesh [07:00 - 08:00, 13:00 - 14:30]
Second : Srinath [07:30 - 08:00, 14:00 - 15:30]
07:30 - 08:00
First : Sona [06:00 - 08:00, 13:00 - 14:30, 17:00 - 21:30]
Second : Mona [05:00 - 05:30, 13:00 - 14:00, 18:00 - 19:00]
13:00 - 13:30
First : Rupa [05:00 - 07:00, 22:00 - 22:30]
Second : Radha [07:00 - 07:30, 19:00 - 23:00]
22:00 - 22:30
First : Chiranjeevi [13:00 - 13:30]
Second : Charan [07:00 - 07:30, 18:00 - 20:00]
null
First : Amulya [07:00 - 07:30, 13:00 - 14:00, 19:00 - 19:30, 21:00 - 21:30]
Second : [17:00 - 19:00]
null

class CommonHalfHourSlotOfTwoEmployees2

{    public static void main(String s[])
    {
        Employee mahesh = new Employee("Mahesh");
        mahesh.freeTimes.add("07:00 - 08:00");
        mahesh.freeTimes.add("13:00 - 14:30");
        Employee srinath = new Employee("Srinath");
        srinath.freeTimes.add("07:30 - 08:00");
        srinath.freeTimes.add("14:30 - 15:00");
        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;
ArrayList<String> freeTimes = new ArrayList<String>();

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

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