Programming Task 8


Time Estimate: 7 hours

Jump to current week
Requirements

Project Structure


You will continue to add functionality to your existing project from the previous task. There is no new repository to clone.



Specification


In this task, you will implement the following specs.

  • A class named 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.
    • Note: The degrees of separation of a person to themselves is 0. If two people have acted in a movie together, their separation is 1. If two people were never in a movie together, their separation is the number of movies that separate them. For example, in the data provided in movies.csv, Chris Pratt and Kevin Bacon have 2 degrees of separation because Chris Pratt was in Moneyball with Brad Pitt and Brad Pitt was in Sleepers with Kevin Bacon (irl, Chris Pratt was in The Guardians of the Galaxy Holiday Special with Kevin Bacon so their separation is 1, but that movie is not in the movies.csv dataset)
    • Since the movies.csv file provided in task 6 does not contain every single movie, some degrees of separation, and Bacon Numbers, will be slightly off


Testing Utilities


There are no testing utility methods for this task.



Testing Requirements


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




Programming Requirements


Implement the DegreesOfSeparation class.



Autolab Feedback


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.

  1. Testing your testing utility method
    • No testing utility method required. This phase will be free in Autolab
  2. Running your tests on a correct solution
    • Your tests will be run against a solution that is known to be correct. If your tests do not pass this correct solution, there is an error somewhere in your tests that must be fixed before you can move on with the assignment. If your tests don't get past this check, you should re-read this document and make sure you implemented your tests and code according the specification. You should also make sure that if there are multiple correct outputs to the input in your tests cases that you accept any of the outputs as correct
  3. Checking your tests for feature coverage
    • The next phase is to check if your tests check for a variety of features defined by different inputs. You should write at least one test case for each feature to pass this phase
    • Passing this phase does not necessarily mean that your testing is completely thorough. Satisfying Autolab is the bare minimum testing requirement. Not all possible inputs are checked, and it is sometimes possible to pass this phase with weak testing. If you are struggling to earn credit for code that you believe is correct, you should write more than the required tests
  4. Running my tests on your solution
    • Once Autolab is happy with your tests, it will run my tests against your code to check it for correctness. If your testing is thorough, and your code passes your tests, then you should pass this phase. If you pass your tests, but fail one of mine, it is an indicator that you should write more tests to help expose your bug

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.