Write a program to identify a time slot where you can get maximum number of participants.
The time slot returned should be in first employee's time zone.
Input (List |
Output (String) |
---|---|
First : Mahesh EST [07:00 - 11:00, 13:00 - 15:30] |
09:30 - 10:00 |
First : Raju EAT [06:00 - 08:00, 16:00 - 19:30] |
19:00 - 19:30 |
First : Ram SGT [05:00 - 07:00, 13:00 - 18:30] |
15:00 - 15:30 |
First : Chiranjeevi JST [13:00 - 15:30] |
19:30 - 20:00 |
class MaximumNumberOfParticipants
{ 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");
Employee narayana = new Employee("Narayana", "CST");
narayana.freeTimes.add("07:00 - 11:00");
narayana.freeTimes.add("13:00 - 15:30");
Employee mobeen = new Employee("Mobeen", "IST");
mobeen.freeTimes.add("07:00 - 11:00");
mobeen.freeTimes.add("13:00 - 15:30");
Employee siva = new Employee("Siva", "SGT");
siva.freeTimes.add("07:00 - 11:00");
siva.freeTimes.add("13:00 - 15:30");
List employees = new ArrayList();
employees.add(mahesh);
employees.add(srinath);
employees.add(narayana);
employees.add(mobeen);
employees.add(siva);
System.out.println("Maximum number of participants are available in " + findFirstMeetingTime(employees) + " slot");
}
public static String findFirstMeetingTime(List<Employee> employees) {
//Write code here to identify a time slot where you can get maximum number of participants.
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;
}
}
Topic: Locale Class In Java