Lab 3 CSCI
162
Dr.
Wildenberg
This lab has several purposes:
·
Use a static
test-driver
·
Modify a class
by adding a method
·
Practice
careful testing of all methods in a class.
·
Use the Unix tool “script” to save tests.
Start by adding a complement
method to the Set class. The text has a
suggestion with which I very strongly
diagree. Please do not use it.
Instead, if s1 and s2 are sets, let s1.complement(s2)
return s1–s2. In other words let s1.complement(s2) return the set of all elements in s1 but
not in s2.
Then write a static test-driver
method to test the new method as well as all the other methods in the
class. You’ll also need a very small
“main” program to call the static test-driver.
Finally, when you are ready
to show that everything is working you can use “script” to get a copy of the
test results. “Script” is especially
useful if your testing has any interactive aspects (often a good idea).