7.5 Quiz Instructions

Write a program that swaps 2 rows of a 2X2 matrix (2 dimensional array of ints). Print the before and after state of the matrix. This problem is based on self-check problem 29 of chapter 7 in the text.

Your program will run one test case, a matrix of 6 rows and 8 columns with the following data. You may directly copy this to use as your array declaration and initialization. You will swap the 2nd and 5th rows.

int[][] matrixArray = { {11, 12, 13, 14, 15, 16, 17, 18},
{21, 22, 23, 24, 25, 26, 27, 28},
{31, 32, 33, 34, 35, 36, 37, 38},
{41, 42, 43, 44, 45, 46, 47, 48},
{51, 52, 53, 54, 55, 56, 57, 58},
{61, 62, 63, 64, 65, 66, 67, 68} };

Your program will include a void method named matrixSwapRows that accepts the matrix array, and the indexes of the rows to swap. This method will NOT print the results...the main method will print the before and after state.

Print the result on the console using the exact output specified by ArrayMultiDimQuizOutput.txt. Your program must EXACTLY match the designated output. Make sure you use the output comparision tool!

To print the 2 dimensional array use System.out.println(Arrays.deepToString(matrixArray)).

Name your class "<your name>_ArrayMultiDimQuiz" and submit the source code to me via DropItToMe

Follow class programming standards and formatting/indentation rules. Make sure you comment your code!

Quiz Grading

The quiz is worth 35 points.

This is pretty simple...you get 100% if your output exactly matches the expected output...and...0% if it has ANY differences.

Make sure you get all the spelling, capitalization, punctuation, spacing, etc. correct! Hint: copy-n-paste is a wonderful thing! :)