Code For NonGeek
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Imagine you have a call center with three levels of employees

Go down

Imagine you have a call center with three levels of employees Empty Imagine you have a call center with three levels of employees

Post  Admin Wed Sep 07, 2011 5:30 pm

Imagine you have a call center with three levels of employees: fresher, technical lead (TL), product manager (PM). There can be multiple employees, but only one TL or PM. An incoming telephone call must be allocated to a fresher who is free. If a fresher can’t handle the call, he or she must escalate the call to technical lead. If the TL is not free or not able to handle it, then the call should be escalated to PM. Design the classes and data structures for this problem. Implement a method getCallHandler().

class CallHandler{
static final int LEVELS=3;
static final int NUM_FRESHERS=5;
ArrayList<Employee>[] employeeLevels=new ArrayList<Employee>[LEVELS];
Queue<Call>[] callQueues=new LinkedList[LEVELS];

public CallHander(){}

Employ getCallHandler(Call call){
for(int level=call.rank;level<LEVELS-1;level++){
ArrayList<Employee> employeeLevel=employeeLevels[LEVELS];
for(Employee emp: employeeLevel){
if(emp.free)
return emp;
}
}
return null;
}
void dispatchCall(Call call){
Employee emp=getCallHandler(call);
if(emp!=null)
emp.ReceiveCall(call);
else{
callQueues[call.rank].add(call);
}
}
void getNextCall(Employee e){}
}

class Call{
int rank=0;
public void reply(String message){}
public void disconnect(){}

}
class Employee{
CallHandler callHandler;
int rank;
boolean free;
Employee(int rank){this.rank=rank;}
void ReceiveCall(Call call){}
void CallHandled(Call call){}
void CannotHandle(Call call){
call.rank=rank+1;
callHandler.dispatchCall(call);
free=true;
callHandler.getNextCall(this);
}
}

class Fresher extends Employee{
public Fresher(){super(0);}
}

class TechLead extends Employee{
public TechLead(){super(1);}
}

class ProductManager extends Employee{
public ProductManager(){ super(2);}
}

Admin
Admin

Posts : 131
Join date : 2011-08-16

https://codefornongeek.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum