about | help | code help+videos | done | prefs |
box
Write a method named box that returns a string representation of a two-dimensional array of int. The parameter is the number of rows (the number of columns is the same.) This square matrix should have all the elements 0 except the outside elements, which should be 1's. For example, box(4) should return {{1,1,1,1},{1,0,0,1},{1,0,0,1},{1,1,1,1}}. Create the array in this method, then use toString() to return the array as a string. You must cut and paste method toString() from the Hint. box(1) → "{{1}}" box(2) → "{{1,1},{1,1}}" box(3) → "{{1,1,1},{1,0,1},{1,1,1}}" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 328 Post-solution available
Copyright Nick Parlante 2017 - privacy