Question: public class DriverExample { public static void main ( String [ ] args ) { char [ ] [ ] array 1 = { {

public class DriverExample { public static void main(String[] args){ char[][] array1={{'A','B'},{'C','D'},{'E','F'}}; String answer = "Original:
"; answer += getTwoDimArrayString(array1); answer +="
After one top rotation:
"; TwoDimArrayUtil.rotateTopOneRow(array1); answer += getTwoDimArrayString(array1); answer +="
After two top rotations:
"; TwoDimArrayUtil.rotateTopOneRow(array1); answer += getTwoDimArrayString(array1); answer +="
After left rotation:
"; TwoDimArrayUtil.rotateLeftOneColumn(array1); answer += getTwoDimArrayString(array1); char[][] array2={{'G','H'},{'I','J'},{'K','L'}}; char[][] array3={{'M','N'},{'O','P'},{'Q','R'}}; answer +="
After left right append:
"; answer += getTwoDimArrayString(TwoDimArrayUtil.appendLeftRight(array2, array3)); answer +="
After top bottom append:
"; answer += getTwoDimArrayString(TwoDimArrayUtil.appendTopBottom(array2, array3)); answer +="
Animation of horizontal bars:"; int maxRows =6, maxCols =6, bars =3, animationType =1; char color1='R', color2='G', color3='B'; HorizontalBars horizontalBars = new HorizontalBars(maxRows, maxCols, bars, color1, color2, color3, animationType); answer +="
Original:
"; answer += getTwoDimArrayString(horizontalBars.getBoard()); for (int i =1; i =3; i++){ answer +="
Animation Step: "+ i +"
"; char[][] nextAnimationStep = horizontalBars.nextAnimationStep(); answer += getTwoDimArrayString(nextAnimationStep); } System.out.println(answer); } private static String getTwoDimArrayString(char[][] array){ if (array == null){ throw new IllegalArgumentException("Invalid parameter getTwoDimArrayString()"); } String answer =""; for (int row =0; row array.length -1; row++){ answer += Arrays.toString(array[row])+"
"; } answer += Arrays.toString(array[array.length -1]); return answer; }}
Output
Original: [A, B][C, D][E, F] After one top rotation: [C, D][E, F][A, B] After two top rotations: [E, F][A, B][C, D] After left rotation: [F, E][B, A][D, C] After left right append: [G, H, M, N][I, J, O, P][K, L, Q, R] After top bottom append: [G, H][I, J][K, L][M, N][O, P][Q, R] Animation of horizontal bars: Original: [R, R, R, R, R, R][R, R, R, R, R, R][G, G, G, G, G, G][G, G, G, G, G, G][B, B, B, B, B, B][B, B, B, B, B, B] Animation Step: 1[R, R, R, R, R, R][G, G, G, G, G, G][G, G, G, G, G, G][B, B, B, B, B, B][B, B, B, B, B, B][R, R, R, R, R, R] Animation Step: 2[G, G, G, G, G, G][G, G, G, G, G, G][B, B, B, B, B, B][B, B, B, B, B, B][R, R, R, R, R, R][R, R, R, R, R, R] Animation Step: 3[G, G, G, G, G, G][B, B, B, B, B, B][B, B, B, B, B, B][R, R, R, R, R, R][R, R, R, R, R, R][G, G, G, G, G, G] the combineleft right combine topbuttom and the flag this all what i need
Method Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, tostring, wait, wait, wait
Method Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, tostring, wait, wait, wait
Constructor Detail
public class DriverExample { public static void

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!