Java Programming. Needs to be done with loops. Define a public static method called printPyramid(). This method should have public static as its visibility modifiers. It should not return a value. It has a single integer parameter. When printPyramid() is called with an integer value, it should print a pyramid with a height of that value. For example, if we call printPyramid() with an integer value of 5, then the following should be displayed in the output console. * * * * * * * * * * * * * * * You will have to use multiple for loops (consider nested for loops) to write this method. ❏ In your main method, you should ask the user for the desired height of the pyramid. The user should provide a value greater than 1. If the user does not provide a valid value, you should force the user to continue entering values until they enter a correct one. Then, call the printPyramid() method with the height given by the user.
Java Programming. Needs to be done with loops.
Define a public static method called printPyramid(). This method should have public
static as its visibility modifiers. It should not return a value. It has a single integer parameter.
When printPyramid() is called with an integer value, it should print a pyramid with a height
of that value.
For example, if we call printPyramid() with an integer value of 5, then the following should
be displayed in the output console.
*
* *
* * *
* * * *
* * * * *
You will have to use multiple for loops (consider nested for loops) to write this method.
❏ In your main method, you should ask the user for the desired height of the pyramid. The user
should provide a value greater than 1. If the user does not provide a valid value, you should force
the user to continue entering values until they enter a correct one.
Then, call the printPyramid() method with the height given by the user.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images