A enter the number of marbles to create a jar 12 b

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

View Full Document Right Arrow Icon
(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 remove(const Marble& m) 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. R EPORT 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
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern