You will continue to add functionality to your existing project from the previous task. There is no new repository to clone.
In this task, you will implement the following specs.
DegreesOfSeparation
in the ratings package with:
DegreesOfSeparation
has a constructor that takes an ArrayList
of Movies
DegreesOfSeparation
has a method named degreesOfSeparation
that takes 2
Strings
and returns an int
. The inputs are the names of 2 cast members, and the method
returns their degrees
of separation. This number is how many people need to be traversed
to move from one person to the other where two people are connected if they starred in
a movie together. When computing the degrees of separation, only the
movies provided in the constructor can be used. If the two cast members are not
connected, or if one of them is not in any of the provided movies, this method returns -1.
There are no testing utility methods for this task.
Write tests in a class named TestDataStructures3
in the tests
package that tests
the DegreesOfSeparation
class.
Testing with files is not required for this task, though you still may find generating small test files useful when writing your tests. If you create test files for your test cases, all of your data files must be in a directory named "data" in the root of your project following the same structure as task 6.
Note: It is undefined what the degree of separation of someone to themself if they've never been in any movies (It can be argued that their degree of separation is either 0 or -1). To avoid this ambiguity, do not write a test case for this situation
Implement the DegreesOfSeparation
class.
The feedback in Autolab will be given in 4 phases. If you don't complete a phase, then feedback for the following phase(s) will not be provided.
Once you complete all 4 phases, you will have completed this Task and Autolab will confirm this with a score of 1.0 for complete.