[Solved] : Question 100130

6.Create a class Fact. Each Fact has an integer ID. Ever Fact also has a list of Fact pointers. Ask the user for an integer N which is the number of Facts to be generated. After all of them are generated and added to a list, go back through and add a random number 0 to 5 Fact pointers to EACH of them. This creates a rather complex mesh of Facts. Display your mesh, then choose one of them at random and display all reachable facts. Do not report loops. For example

If the user enters N = 8

And the following Facts are created randomly:
#1 -> 2, 5
#2 -> none
#3 -> 4, 5, 7
#4 ->3, 6
#5 ->7
#6 ->1
#7 ->2

IF
#4 is chosen the result would be
#4 ->3, 6, 5, 7, 1, 2

since
4 connects to 3 and 6
3 connects to 4 , 5, 7
6 connects to 1
5 connects to 7
7 connects to 2
1 connects to 2, 5
2 connects to none

IF
#1 is chosen
The result would be
#1 ->2, 5, 7

Since
1 connects to 2, 5
2->none
5 connects to 7
7 connects to 2


Expert Answer


Answer to : Question 100130

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us