Question: makePyramid(int n, String s) Write a method called makePyramid that given an odd integer n and a String s, prints a pyramidal shape using s.

makePyramid(int n, String s) 

Write a method called makePyramid that given an odd integer n and a String s, prints a pyramidal shape using s. Please try to reuse makeRow method you have made.

The top of the pyramid has a single copy of s, and each successive row has two additional copies of s. A row should have prefix and postfix consisting of underscores. The total number of symbols of one row is equal to n. The last row contains n copies of s. For example, calling makePyramid(7, "*"); prints the following lines:

===*=== ==***== =*****= ******* 

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!