MCPcopy Create free account
hub / github.com/careercup/ctci / Call

Class Call

java/Chapter 8/Question8_2/Call.java:6–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4 * first employee who can handle that call.
5 */
6public class Call {
7 /* Minimal rank of employee who can handle this call. */
8 private Rank rank;
9
10 /* Person who is calling. */
11 private Caller caller;
12
13 /* Employee who is handling call. */
14 private Employee handler;
15
16 public Call(Caller c) {
17 rank = Rank.Responder;
18 caller = c;
19 }
20
21 /* Set employee who is handling call. */
22 public void setHandler(Employee e) {
23 handler = e;
24 }
25
26 /* Play recorded message to the customer. */
27 public void reply(String message) {
28 System.out.println(message);
29 }
30
31 public Rank getRank() {
32 return rank;
33 }
34
35 public void setRank(Rank r) {
36 rank = r;
37 }
38
39 public Rank incrementRank() {
40 if (rank == Rank.Responder) {
41 rank = Rank.Manager;
42 } else if (rank == Rank.Manager) {
43 rank = Rank.Director;
44 }
45 return rank;
46 }
47
48 /* Disconnect call. */
49 public void disconnect() {
50 reply("Thank you for calling");
51 }
52}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected