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.

In Java and error free, please. Thank you in advance. Exercise#2: Write

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

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!