Due Monday, December 5 at 11:59 PM
By the time you have completed this work, you should be able to write programs which:
fail()to trigger test case failure
SwapMultidimensional.java file, and open it in jGrasp (or a text editor of your choice).
This program contains two methods which you will need to write:
swapRows: Swaps the contents of two rows, given a two-dimensional array and the indices of the rows to swap.
swapCols: Swaps the contents of two columns, given a two-dimensional array and the indices of the columns to swap.
main contains some code which will call
swapCols, for the purpose of informal testing.
With this in mind, example output of the program is below:
Before swapping rows 0 and 2: 0 1 2 3 4 5 6 7 8 After swapping rows 0 and 2: 6 7 8 3 4 5 0 1 2 Before swapping columns 1 and 2: 9 8 7 6 5 4 3 2 1 After swapping columns 1 and 2: 9 7 8 6 4 5 3 1 2
SwapMultidimensionalTest.javaas a Test File, and Edit It
SwapMultidimensionalTest.java file, being sure to put it in the same folder/directory as your
Open this file in jGrasp as a test file, using the same instructions you've used in previous labs.
This time around, you have been provided will all the tests, though you may add your own if you wish.
However, you will need to define the
assert2DEquals method in the test suite in order to make the provided tests actually do anything meaningful.
The comments in
SwapMultidimensionalTest.java provide more details.
Log into Canvas, and go to the COMP 110 class. Click “Assignments” on the left pane, then click “Lab 17”. From here, you can upload your answers and your code. Specifically, you must turn in the following two files:
In addition, if you collaborated with anyone else, be sure to download
collaborators.txt and write the names of the people you collaborated with in the file, one per line.
Please submit this file along with the other two files.
You can turn in the assignment multiple times, but only the last version you submitted will be graded.