Question: 1. Create an application DiminishingSquares that accepts a command line integer argument n and then outputs a square of asterisks of size n n, followed

1. Create an application DiminishingSquares that accepts a command line integer argument n and then outputs a square of asterisks of size n n, followed by another of size (n-1) (n-1), and so on, stopping after it draws a 1 1 square. Your applications should include a recursive drawSquares(int side) method that is called once by the main method and that handles all of the output. For example, if the argument to the application is 3, the output would be: (15 points)

***

***

***

**

**

*

2. Code the methods described in part a. Hint: Use recursion to iterate across the lines of asterisks, but, use a for loop to generate the asterisks within a line. (15 points)

a. Code a recursive method printTriangleUp (int n) that prints asterisks to System.out consisting of n lines, with one asterisk on the first line, two on the second line, and so on. For example, if n is 4 the final result would be:

*

**

***

****

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!