Question: Programming The students are expected to use a 2 D array to construct the pyramid. The pyramid is constructed using the characters X ( bricks

Programming
The students are expected to use a 2D array to construct the pyramid. The pyramid is constructed using the characters X(bricks) and =(no brick).
Bricks, denoted by the symbol X, are to be placed beginning at the bottom left and continue until either 1) there are no more bricks or 2) the pyramid is complete.
The surrounding area is to be filled with the symbol =.
Once the 2D array (pyramid) is constructed print:
the 2D array starting at row and column zero [0,0].
the number of bricks remaining, in the format listed below.
Note: Keep in mind that the output is expected be PRINTED into the terminal.
Programming
Example 1: Executing the command
javac EgyptianPyramid.java
java EgyptianPyramid 31
produces a 332D grid with 1 initial brick to construct the pyramid.
The output looks like this (Note the placement of the brick is on the left side of the last row):
Example 2: Executing the command
javac EgyptianPyramid.java
java EgyptianPyramid 45
produces a 442D grid with 5 initial bricks to construct the pyramid.
The output looks like this:
Example 3: Executing the command
javac EgyptianPyramid.java
java EgyptianPyramid 516
produces a 552D grid with 16 initial bricks to construct the pyramid. The output looks like this:
Problem by Kushi Sharma and Ayla Muminovic

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 Programming Questions!