Figure 12-26 shows two typical executions of a program that displays a triangle. Create this program by

Question:

Figure 12-26 shows two typical executions of a program that displays a triangle. Create this program by prompting the user for a number of lines to display. The first row of the output contains the number of spaces that equals the number of lines that will eventually display. Pass the final number of lines, the current line number, the spaces to display, and the number of letters to display to a recursive method. The base case occurs when the current line equals the total number of lines to display. If the total number of lines has not yet been displayed, reduce the number of spaces, increase the number of letters, increase the current line number, and call the method again. Save the program as TriangleRecursive.java.


Data from in Figure 12-26

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

Step by Step Answer:

Related Book For  answer-question

Java Programming

ISBN: 9780357673423

10th Edition

Authors: Joyce Farrell

Question Posted: