{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

4 another representation defines a jar as a linked

Info iconThis preview shows pages 2–3. Sign up to view the full content.

View Full Document Right Arrow Icon
4. Another representation defines a jar as a linked list using the C++ library class list and it will be given to you. You need to work with this code to eliminate run-time errors and/or logical errors with the help of a debugger (gdb or Visual Studio). You need to fix all the bugs, and describe them in your report. 5. Provide results of your tests for both the implementations. F ILE NAMES Use these file names (unless you have a good excuse to name them differently): 1. marble.h – the class Marble 2. marble.cpp – implementation of the class Marble 3. jar.h – the abstract class Jar containing all the virtual functions 4. vector_jar.h – the class VectorJar 5. vector_jar.cpp – implementation of the class VectorJar 6. llist_jar.h – the class LListJar (this file will be given) 7. llist_jar.cpp – implementation of the class LListJar (this file will be given) 8. jar_test.cpp – a file containing the main function and test functions. 9. (optional) jar_main.cpp – if you want to keep the main function separate, put it in this file 10. Makefile – use this file to compile your code. 2
Background image of page 2

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
T ESTING In order to have a uniform testing scheme we require all of you to have the same user interface to the program. We expect the behavior of the various set operations to be the same for everyone. Therefore, make sure you write these functions to print the contents of a jar object to a file as well as read one from a file 1. Add a function void writeJarToFile(VectorJar& J1, string fileName) to your test file. This function should take a jar object you want to print out and the file name as arguments. For example, if a jar contains two marbles (red, large) and (green, small), the file would contain the following two lines: r l g s 2. Similarly add a function void readJarFromFile(VectorJar& J2, string fileName) to read in the file you just wrote. 3. You can test all the operations by using three jars. Use the following menu function for your testing.
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}