Kotlin
Java

MP3: Restaurant View Revisited
Kotlin

Created By: Geoffrey Challen
/ Updated: 2021-11-18

To wrap up MP3 we'll return to our restaurant activity and update the view to incorporate some of the new information we can now compute about each restaurant. Most of our work will be in the restaurant activity and it's layout, but there are a few other things to fix as well.

Restaurant View Changes

Our final task (!) on the machine project is to update our restaurant view to display two new pieces of information:

  1. The name of the restaurant that is most related to the one that is shown
  2. The count of restaurants within a two-hop radius of the restaurant shown, only considering restaurants that are connected with a weight of more than two

You'll note that these two pieces of data can be derived in a straightforward way from the results of calling the two new methods that you just added to your RelatedRestaurant class:

  1. The name of the most-related restaurant is the name of the first restaurant returned by getRelatedInOrder. (If there are ties, you can still just display the first restaurant from the list.)
  2. The count is the size of the set returned by getConnectedTo.

So once you completed the first test suite cases from MP3, you are close to being finished.

However, we still have a bit more work to do to make the results of these methods available to our RestaurantActivity. Let's discuss a few of the remaining steps.

Talk about some of the final steps that we need to complete to display the new information in the RestaurantActivity.

No Homework Today

As a reminder, on lessons where we focus on the machine project we will not assign a homework problem! However, the lesson will usually focus on helping you complete a particular part of the MP test suite, and so we encourage you to spend time on that in lieu of a homework problem.

Today your goal should be to complete the third MP3 test case: testRestaurantView. And, when you do, you'll have completed the MP!

If you get stuck, find us for help on the help site or forum.