MP3: Restaurant Relationships

Learning Objectives

MP3 picks up where MP2 lefts off, and concludes the machine project. You have a few more programming tasks to complete, including a pair that are algorithmic in nature and some final work with your restaurant activity.

After completing MP3 you'll have demonstrated your ability to work with data using the data structures you're now familiar with—including lists, maps, and sets. We'll also bring in what you've learned about graphs, sorting, and hashing. And, as always, we'll guide you every step of the way.


MP3 has two deadlines. We provide 10 points for getting started on the MP promptly and earning a certain number of points before the early deadline. The remainder of the MP is due a few days later.

Note that MP3 (1) only has three test cases, and (2) has all three lessons before the early deadline. Our goal is to help you wrap up in time so that you can focus on the final quiz and, then, on your other classes.

For MP3 the deadlines are:

  • Early Deadline: Sunday 12/5/2021 at 11:59PM Central Time
  • Full Deadline: Wednesday 12/8/2021 11:59PM Central Time—note that this is a bit earlier since Wednesday is the last day of the semester.

Objectives, Testing, and Grading

To obtain the MP3 test suites:

  • If you are using Kotlin, download the MP3 tests and move the file to the app/src/test/kotlin/edu/illinois/cs/cs124/ay2021/mp/ directory in your machine project.
  • If you are using Java, download the MP3 tests and move the file to the app/src/test/java/edu/illinois/cs/cs124/ay2021/mp/ directory in your machine project.

Next, you'll want to reconfigure grade.yaml in the root directory of your project to request that we grade Checkpoint 3.

Completing MP3 requires applying several ideas that you've learned recently, including graphs, sorting, and hashing. It also provides practice working with standard data structures, including lists, maps, and sets. As always, you will spend much more time understanding what the problem is and identifying the code you need to modify than you will actually implementing your solution.


MP3 is broken into three steps that both derive and expose more data about restaurant preferences in your app. Each is covered in a separate lesson.

  1. First, you'll produce a list of related restaurants given a restaurant ID, sorted by the strength of the relationship and by name.
  2. Next, you'll exploit the graph structure of the restaurant preferences to count the number of related restaurants within a few steps of a given restaurant.
  3. And finally, you'll expose these new pieces of data using your RestaurantActivity.

Completing MP3 requires creating several new methods and other changes to your existing code. We'll walk through all of these changes in the daily lessons.


We have provided three test cases to guide your development.

testGetRelatedInOrder is a unit test that tests whether you can produce a list of related restaurants sorted appropriately. testGetConnectedTo is also a unit test and tests whether you can enumerate how many restaurants are within a few hops of a starting point, using the graph created by the restaurant preferences. Finally, testRestaurantView tests whether you can display these pieces of data to the user as part of your RestaurantActivity. You should start by completing the unit tests. The lessons will proceed through the test suites in the order that we recommend you complete them in, which is also the order that they appear in the test suite.


Grading for MP3 is broken down as follows:

  • 10 points for no checkstyle (Java) or detekt (Kotlin) violations
  • 20 points for testGetRelatedInOrder
  • 20 points for testGetConnectedTo
  • 20 points for testRestaurantView
  • 10 points for earning at least 40 points by the early deadline
  • And 20 points because you are awesome and made it to the end of the semester!

You can estimate your grade at any time by using the Grade task available in Android Studio. This is an estimate, not an official score.


You submit MP3 by pushing to GitHub, in the same way that you did for MP0, MP1, and MP2. However, make sure that you have configured grade.yaml before pushing. We grade the checkpoint you have configured in grade.yaml. So make sure that is set up to grade MP3 once you are ready.


Please review the CS 124 policies on collaboration.

All submitted code will be checked for cheating. Cheaters will receive stiff penalties. Hard-working students who are struggling honestly for their grade demand it.


You can view your official MP3 scores below.