First, you have to understand: the method AddRowAtTheBack. These methods will also be in the class CoordinateRow.

The first 2 steps will be the same, in short:

new:

  1. method addCoordinateInTheFront

2. method add Row in The Front

If you want to add row:

java programming row

In front of coordinateArray:

java programming row

The method addRowInFront has to do the following:

this is an example, the value of the elements are just random.

java programming row

In java code language you will use this code (sketch):

void addRowInFront(CoordinateRow row) {
	//loop through your row from back to front, because you want the last element
}

if you work out the sketch:

Like we did in the method addRowAtTheBack, we used our knowledge about objects to get the numberOfElements and the values of the elements. (row.numberOfElements and row.coordinateArray[i])

void addRowInFront(CoordinateRow row) {
	for(int i = row.numberOfElements-1; i >=0 ; i--) {
		addCoordinateInFront(row.coordinateArray[i]);
	}
}