CSE 109 Programming Assignment #4 Due: 10:45 PM Thursday 22 March 2012 [Late collections 10:45 PM 24, 25 March] This assignment is an exercise in writing templates for classes. In particular, I ask you to template the class Node with two types, one for the key, the other for the data. Then I ask you to create a templated Tree class (also templated by a key type and by a data type). In both cases, you should start with the class used in p2 and edit it, replacing some type names with the appropriate template variables, e.g., replacing "Word" with KEY. In /proj/csc109/p4 you will find the file p4.cc, which contains a sample program for testing out your templated classes. (You will note that there is no mention of class Node<> in p4.cc, because it is a class that is used by class Tree<>.) You will also find the file a comment in p4.cc which shows the output I obtained when using my implentation of the templates for Node and Tree. Start this assignment by creating the subdirectory p4 in your subdirectory cse109.121 and copying the files /proj/csc109/p4/p4.cc. Then copy your tree.cc, tree.h, node.cc, node.h, word.cc, and word.h, from p2. The contents of tree.cc and tree.h should be stored in the file tree.t and then modified to get a template for class Tree. In the same way, store the contents of node.h and node.cc in node.t and modify the result to get a template for the class Node. Create a Makefile for separate compilation of the p4.cc and the class Word. Note that no other classes get compiled separately. Indeed, there are no other classes, just templates for other classes. I will test your classes by using the command "make clean" to discard all .o files (where you should implement "clean" in your Makefile), by replacing your p4.cc with a file /proj/csc109/p4/p4.cc, by using your Makefile to compile p4.cc (and the code for your templates), and then by running the resulting executable file p4. IT IS IMPORTANT THAT YOU COMPILE ALL YOUR .cc FILES WITH THE -Werror -Wall OPTIONS (E.G., g++ -c -Werror -Wall p4.cc). When you are ready to submit your work, create the file "DONE" by executing the command "touch DONE". Notes: 1. All your files should have good documentation. Each file should have identifying information at the top, e.g., your name, the course, the assignment number. Each class declaration should be documented with comments at the top which explain the class and its purpose. The role of each data member should be explained. Each member method should be explained (e.g., by stating pre- and post-conditions and by stating the overall algorithm). Hard to understand sections of code should be explained. This means that most of the documentation goes in the .h file. and for p4.cc. 2. I may test your classes with some other programs. 3. You should use your class Word from programming assignment 1. But what if the class Word you developed for programming assignment 1 does not function well. In that case, I provide the files word.h and word.o (the object file compiled from my solution for p1). I have stored these files in /proj/csc109/p4. If you use word.h and word.o. Similarly, if you failed to implement the classes Node and Tree for assignment 2, then you can use my code, which is stored in /proj/csc109/p4/node.t and /proj/csc109/p4/tree.t. 4. If you do use my word.h and word.o, then you should add the following line to the "clean:" target: cp /proj/csc109/p4/word.o word.o Otherwise, even though your solution compiles, you will get a message of a failure to compile when the little green man collects your files for p4. IN THE SYLLABUS READ THE STATEMENT ABOUT UNFAIR COLLABORATION AND AVOID UNFAIR COLLABORATION