Modify the method created in Exercise 5.18 to receive a second parameter of type char called fillCharacter.

Question:

Modify the method created in Exercise 5.18 to receive a second parameter of type char called fillCharacter. Form the square using the char provided as an argument. Thus, if side is 5 and fillCharacter is #, the method should display

##### ##### ##### ##### #####

Use the following statement (in which input is a Scanner object) to read a character from the user at the keyboard: // next() returns a String and charAt(0) gets the String's first character char fill = input.next().charAt(0);

Exercise 5.18

Write a method squareOfAsterisks that displays a solid square (the same number of rows and columns) of asterisks whose side is specified in integer parameter side. For example, if side is 4, the method should display

**** **** **** ****

Incorporate this method into an application that reads an integer value for side from the user and outputs the asterisks with the squareOfAsterisks method.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: