Starting from:

$25

CS461-Homework 4 Solved

In this homework you are expected to obtain the ​class-precedence list​ for a given class hierarchy. The normal way of doing this is to implement the ‘fish hook algorithm’ given by Winston (chapter 9). But reuse of any ​topological sorting​ program is also permitted, provided that you clearly state where you found it. You must also tell, in precise terms, how you modified it to fit the needs of this assignment.

 

You should test your program with the examples (class hierarchies) given  in the following pages to make sure that it reports class-precedence correctly. The input file (data structure) should be manually prepared using the class hierarchy pictures depicted in the sequel. Khan Academy can be consulted about the alternatives:

 

 

The output of your program should simply be a linear list, with the highest and lowest precedence ends clearly identified. (In test examples 1 and 2, feel free to add, for the sake of observing the convention of chapter 9, the universal class called ​Everything.)​ Do not forget to submit the entire code (even if it is not yours).

 

Your program should have a simple control for ‘single stepping’ (tracing your code) so that you and the TAs can inspect the intermediate stages of the problem-solving process in an incremental fashion.

TEST EXAMPLES AND GRADING 

The first and the second examples are worth 3 points each. The third example is worth 4 points.

 

1  (​ Compute three lists: one for ​ifstream​, one for ​fstream​, one for ​ofstream​)

  

 

2  (​ Compute three lists: one for ​Consultant Manager​, one for ​Director​, one for ​Permanent Manager​)

  

3  (​ Compute two lists: one for ​Crazy​, one for ​Jacque​)

More products