Dependencies after an Information Expert refactor

A payroll design has five classes. Department holds a list of its Employee objects, and each Employee holds a reference to its PayGrade. In the original design, PayrollReport gets the employees from Department, reads each employee's name, hours and grade, asks PayGrade for the hourly rate, asks TaxTable for the tax rate, computes net pay and prints a line per employee.


The team refactors using Information Expert. Employee.netPay() now computes net pay using its own hours, its PayGrade and a tax rate it requests from TaxTable. Department.totalNetPay() sums its employees' net pay. PayrollReport gets the employees from Department, prints each employee's getName() and netPay(), then prints Department.totalNetPay().


Treat a dependency as directed (class X depends on class Y) and count each ordered pair of classes once, however many calls it involves. How many distinct dependencies does the refactored design contain? Answer as a whole number.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Allocating Responsibilities to Classes Questions: