int
Array bound by MAX_SIZE
Fill in the edges of the array such that all edges have the value 1
Example
let ( MAX_SIZE = 6; )
1 1 1 1 1 1
1 - - - - 1
1 - - - - 1
1 - - - - 1
1 - - - - 1
1 1 1 1 1 1
let ( MAX_SIZE = 4; )
1 1 1 1
1 - - 1
1 - - 1
1 1 1 1
etc.
Create a void method that takes a 2D Array as its only argument Method will print the array in the format above.
As non-edge values in the index are not initialized, check to make sure the array has a value at the given index, otherwise print “ - “
i.e.
1 1 1 1
1 - - 1
1 - - 1
1 1 1 1
Create new class ArrayWrapper
with ArrayWrapper class
Create a constructor for ArrayWrapper
that takes an int
argument
MAX_SIZE
Create a 2D array bound by MAX_SIZE
Create length
property set to MAX_SIZE
Create a fill()
method that will set all edges of the array to 1
Create a toString()
method to print array in format listed above.
Write your ArrayWrapper.fill()
method without using any if
statements
and only 1 for
loop!