Question: The first assignment had me do Write a void method squareOfAsterisks() that displays a solid square of asterisks whose side is specified in integer parameter

The first assignment had me do "Write a void method squareOfAsterisks() that displays a solid square of asterisks whose side is specified in integer parameter side. For example, if side is 4, the method should display a 4x4 square. Use nested for loops. Test the method in an application that reads an integer value for side from the user and outputs the asterisks with the squareOfAsterisks method"

Now I have to complete this task "Modify the method created in classwork #2 to receive a second parameter of type char called fillCharacter. Form the square using the char provided as an argument. Use the following statement (in which input is a Scanner object) to read a character from the user at the keyboard: char fill = input.next().charAt(0); Thus, if side is 5 and fillCharacter is #, the method should display"

Help, advice, anything that helps me better understand how to tackle this problem would be amazing. Below is the first assignment.

public class squareOf { public static void main(String[] args) { squareOfAsterisks(4); } public static void squareOfAsterisks (int sides) { for(int n = 0; n < sides; n++) { for(int i = 0; i <= sides; i++) { System.out.print('*'); } System.out.println(); } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!