|Programming Project 6|
Numberclass, are more difficult due to their stateful nature. We can no longer test all methods individually, without at least calling the constructor. For this reason, we will not be writing formal test cases for the project; we need a better testing infrastructure, which you will learn about in CS211 if you take it. Instead, we will some provide tests for you; the rest you will need to write on your own. For this project, we will not check your tests on Marmoset, to give you the experience of testing in the real world.
banner.pyfile with the following methods:
|A constructor that takes a message. The constructor creates the message attribute, and sets it to the incoming argument. The constructor also initializes an empty dictionary.|
A method called
If a number already exists in the dictionary, it will overwrite the old value with the newer one.
To test that a number has been added to an existing banner, you can add the following to your
The example above added a 3x4 number "two" to a banner previously created.
A to-string method that can be called with
project5.pythat has the following functionality:
The file contents will be as follows:
If the file cannot be opened, the function raises a
You should use the python documentation, or the Internet, to figure out how to open and read a file to place its contents into a list. Make sure to cite your resources. Please note, you may only look for code online for how to open and read a file, and NOT any other part of this project.
returnstatement to get your functions to return a value - DO NOT use the
driver.pyfile that will use your
tests.txtfile and print out whether or not the tests you wrote passed or failed, on the python code you wrote. To use this driver, make sure your
driver.pyare all in the same directory, and from a terminal in that directory, type:
stopon a single line after the last test you want run.
#. Note that you DO NOT have to comment out your print statements to run your test suite at home using
driver.py. Marmoset submission should be a last and rare step!
tests.txtabove: these tests are the Public Tests and Release Tests on Marmoset.
DriverJava.javafile (see above for how to convert your
tests.txtfile into this
DriverJava.javafile) on Marmoset following the link to CS112-4T. (The T stands for TEST)
number.py. Normally, Marmoset is set up to work with Java files, which is why we have this workaround. Submit ONLY your
SystemCall.javafiles on Marmoset following the link to CS112-6C. (the C stands for CODE). Find the link on Marmoset to submit Project 6. Once you pass all the public tests, use your tokens wisely to start examining the release tests. Do not change the name of the files.