Printing The Data At Index N

 

The goal for this exercise is practice traversing the linked list, and stopping at a particular node, in preparation for the ‘Insert a value at an arbitrary location’ exercise in the future.

 For this exercise, you need to implement the PrintNode method in the provided MyIntList class, as well as any other methods that you need to implement in order to accomplish the goal of implementing this method.  This class should be found in the Student_Answers.cs file, in a project named something like 03_PCE_StudentCode.  

             The PrintNode method looks like:

 public void PrintNode(uint i);

 Instead of printing all the elements in the list, it only prints the data of the node at index i.  Remember that uints (“unsigned ints”) can only have positive values, so you don’t have to worry about someone trying to print node -1.  However, the caller can pass in any value that (s)he wants, so you'll have to watch out for someone asking to print the node at index 10 (or 6) in a 5 node list.  If that happens, your method should not print anything to the screen.

 What you need to do for this exercise

  1.  Implement PrintNode, as described above

    1. Implement anything required by PrintNode