Counting recovered relationships in a library system

The following Java source is the complete code of a small library system. String and LocalDate are library types.


Java
public class Library {
    private Book[] catalogue;
    private Member[] members;
}

public class Book {
    private String isbn;
    private Loan currentLoan;
}

public class Member {
    private String name;
    private Loan[] loans;
}

public class StudentMember extends Member {
    private String studentId;
}

public class Loan {
    private Book book;
    private Member borrower;
    private LocalDate due;
}

public class Notifier {
    public void remind(Member member, Loan loan) { /* sends an email */ }
}


Recover a class diagram using these rules: a field whose type is a project class gives an association; two fields in different classes that refer to each other form one bidirectional association; a project type used only as a method parameter gives a dependency. The fan-in of a class is the number of other project classes whose source names it. Give each answer as a whole number:

  • the number of generalizations,
  • the number of associations,
  • the number of dependency-only relationships,
  • the fan-in of Loan.
Your answers

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 Reverse Engineering Questions: