*** You may only submit a given problem once - no resubmissions will be accepted. ***
Diamond and Xerxes Inc. is designing their logo. It will be a hollow (the inside will
be filled with spaces) diamond, in a square field of characters. The edges of the diamond will
be denoted by 'X' (for Xerxes). But how big
should it be? What should the background character be? They want software
that will generate a logo so that they can choose.
.X. --X--
X X -X X-
.X. X X
-X X-
--X--
Above are drawn two possible logos. The left-hand one has size 2 (the number
of X's along each edge of the diamond) and background character '.'. The right-hand one
has size 3 and background character '-'.
Create a class DiamondLogo that contains a method logo that is given an
int size, the number of X's along each edge of the diamond, and a char background that is
the character to be used as the background. The method should return
a String[] giving the resulting square logo. The first element of the return will be
the top row, the next element the second row, etc. The return must not include any extraneous rows or columns.
|