Question: Write a complete Java program called DrawSquare.java that reads a positive integer n from the command line, where n is at least 2, then prints

Write a complete Java program called DrawSquare.java that reads a positive integer n from the command line, where n is at least 2, then prints out an n by n square made of asterisks * to standard out. Your program will print a usage message (see below) and quit if the number of command line arguments is not exactly one, if that argument cannot be parsed as an integer, and if that integer is not at least two. Several runs of the program are printed below. % java DrawSquare Usage: java DrawSquare % java DrawSquare 1 Usage: java DrawSquare % java DrawSquare 2 ** ** % java DrawSquare 3 *** * * *** % java DrawSquare 5 ***** * * * * * * ***** $ java DrawSquare 10 ********** * * * * * * * * * * * * * * * * **********

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!