You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Design the classes and data structures for this problem:
Imagine you have a call center with three levels of employees: respondent, manager and director.
An incoming telephone call must be first allocated to a respondent who is free.
If the respondent can't handle the call, he or she must escalate the call to a manager If the manager is not free or not able to handle it, then the call should be escalated to a director
Design the classes and data structures for this problem.
Implement a method dispatchCalLO which assigns a call to the first available employee
//route the calls to the correct personpublicclassCallHandler{
//SinglethonprivatestaticCallHandlerinstance;
//3 levels of employeesprivatefinalintLEVELS = 3;
//initialize number of each levelprivatefinalintNUM_RESPONDENTS = 10;
privatefinalintNUM_MANAGERS = 4;
privatefinalintNUM_DIRECTORS = 2;
//list of emplyees by levelArrayList<ArrayList<Employee>> employeeLevels = newArrayList<ArrayList<Employee>>();
//queues for each call's rankArrayList<ArrayList<Call>> callQueues;
}
//represents a call from a user. it has a minimum rank and is assigned to the first emplyee who can handle itpublicclassCall{
//minimal rank of employee who can handle the callprivateRankrank;
//person who is callingprivateCallercaller;
//employee who is handling callprivateEmployeehandler;
publicCall(Callerc){
rank = Rank.Responder;
caller = c;
}
publicvoidsetHandler(Employeee){
handler = e;
}
publicvoidreply(Stringmessage){
}
publicRankgetRank(){
returnrank;
}
}
abstractclassEmployee{
privateCallcurrentCall = null;
protectedRankrank;
publicEmployee(){
}
}