Question: In Java and error free, please. Thank you in advance. Exercise#2: Write a program that asks the user to enter the height of pyramid (a
In Java and error free, please. Thank you in advance.

Exercise#2: Write a program that asks the user to enter the height of pyramid (a positive integer from 1 to 10). If a user enters a zero, negative integer or a positive number greater than 10 ask him to re-enter correct value until entering a right positive integer. Then display the pyramid by writing lines of asterisks. For example If first time user enters zero or negative number, the output would be: Sorry, height cannot be zero or negative, try again if second time user enter number greater than 10, the output would be: Sorry, height cannot be greater than 10, try again And, at last if the user enters correct number let say 4, the output would be
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
