Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a complete java program that produces a square pattern of asterisks and spaces. First prompt the user for the size of the pattern, then

Develop a complete java program that produces a square pattern of asterisks and spaces. First prompt the user for the size of the pattern, then use for loops to print out the pattern. If the user enters a value that is not a number your program's behavior is arbitrary. For non-positive values your program should print nothing and end normally. Your program should work for input values up to the width of the terminal window. Examples for the first 6 values are shown below.

Everytime i do the code i get full boxes. I can't seem to figure out how to make them hollow. Question is how is the program supposed to look.

Input: 1 2 3 4 5

6

Output:
*
** **
*** * * ***
**** * * * * ****
***** * * * * * * *****
 ****** * * * * * * * * ******

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions