Question: Lets recreate that pyramid in JAVA, albeit in text, using hashes (#) for bricks, a la the below. Each hash is a bit taller than

Lets recreate that pyramid in JAVA, albeit in text, using hashes (#) for bricks, a la the below. Each hash is a bit taller than it is wide, so the pyramid itself is also be taller than it is wide.

The program well write will be called mario. And lets allow the user to decide just how tall the pyramid should be by first prompting them for a positive integer between, 1 and 8, inclusive.

Once you get your input processing to work properly, it might be easier to build the opposite pyramid first (left-aligned).

It turns out its a bit easier to build a left-aligned pyramid than right-, a la the below.

#

##

###

####

#####

######

#######

Lets now right-align that pyramid by pushing its hashes to the right by prefixing them with dots (i.e., periods), a la the below.

.......#

......##

.....###

....####

...#####

..######

.#######

########

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!