Fill The Boundaries

Part 1

  1. Create a 2-Dimensional int Array bound by MAX_SIZE
  2. 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.

  1. 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
    

Part 2

Create new class ArrayWrapper

with ArrayWrapper class

  1. Create a constructor for ArrayWrapper that takes an int argument MAX_SIZE

  2. Create a 2D array bound by MAX_SIZE

  3. Create length property set to MAX_SIZE

  4. Create a fill() method that will set all edges of the array to 1

  5. Create a toString() method to print array in format listed above.

Bonus

Write your ArrayWrapper.fill() method without using any if statements and only 1 for loop!