3 you can test all the operations by using three jars

Info iconThis preview shows page 3. Sign up to view the full content.

View Full Document Right Arrow Icon
3. You can test all the operations by using three jars. Use the following menu function for your testing. (a) Enter the number of marbles to create a jar ( 12) (b) Write all the jar marbles to a file (c) Read a jar from a file (notation for colors: r , y , b , g ; for sizes: s , m , l ) (d) Remove a marble with specific color (e) Remove a marble with specific size (f) Merge 2 jars read from 2 files, print the resulting jar to the file named “ merge.out (g) Intersect 2 jars read from 2 files, print the resulting jar to the file named “ intersection.out (h) Compute difference of 2 jars read from 2 files, print the resulting jar to the file named “completion.out (i) Exit the program 4. Use menu item (3a) to create a jar object with the number of marbles specified by the user. Print out the jar created in (3a) to a file jar1.in 5. Repeat the above step for creating a second jar object and print it out to the file jar2.in 6. For the menu item (3d), first create a marble with the specified color and random size and call the you wrote for the vector class. Similarly for the menu item (3e). 7. For each of menu items (3f, 3g, 3h) you need to use the files jar1.in and jar2.in you wrote out earlier. So make sure you have them generated before you call any of the menu items (3f, 3g, 3h). Read the contents in jar1.in and jar2.in into two separate jar objects. Create a third empty jar object and call the corresponding operation ( merge , intersection , completion ) on it and print it to a file. For example, you can choose to create three empty jar objects J1, J2 and J3 . Read the contents of jar1.in into J1 , read the contents of jar2.in into J2 and call J3.merge(J1, J2) . After the merge operation, call the function as follows: writeJarToFile(J3, "merge.out") . This process can be repeated for the other two set operations too. 8. Important : Test your program on a CS UNIX machine before returning your assignment for grading. REPORT AND PROGRAM DOCUMENTATION Follow the general steps to prepare a hard and soft copy of the report, see http://courses.cs.tamu.edu/teresa/csce221/pdf/Grading.pdf and http://courses.cs.tamu.edu/teresa/csce221/doc/csce221-A1-Lab-Instr.doc 3
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online