Lets think about your computer science class for a moment. You might know several students, perhaps Judy,

Question:

Let’s think about your computer science class for a moment. You might know several students, perhaps Judy, Jervis, Walter, and Michael. Each of those students knows several other students, and each of them knows more students, and so on. Now, there is one particular student named Dor that you would like to meet. One way to meet Dor would be if you had a mutual acquaintance. You know Judy, and Judy knows Dor, so Judy could introduce you to Dor. Or there might be a longer path of acquaintances. For example, youknow Judy, and Judy knows Harry, and Harry knows Cathy, and Cathy knows Dor. In this case, Judy can introduce you to Harry, Harry can introduce you to Cathy, and Cathy can introduce you to Dor.

Write an interactive program to help you figure out whether there is a path of acquaintances from you to Dor. The program should include a recursive method that has one argument, person, which is the name of a person in your class. The method determines whether there is a path of acquaintances from person to Dor.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: