Answer to Question #256686 in Algorithms for Dion Martins

Question #256686

Do the necessary planning (IPO) and write an algorithm in pseudo code for the following


The user must enter a positive integer between 5 and 15. If this number is valid, the user must also choose between a triangle (T or t) and a square (S or s). Display suitable error messages if necessary; otherwise, the program must use an asterisk to draw a triangle or a square of the chosen size and display. Use a Select Case structure to make the decision. Display appropriate error messages where applicable.


1
Expert's answer
2021-10-30T00:38:41-0400

display 'Enter positive integer x between 5 and 15:'

int x

if "5\\le x\\le 15" then

display 'Choose triangle (t) or square (s)'


case t:

draw a triangle using an asterisk

case s:

draw a square using an asterisk

case else:

display 'Error'


else if "x<5" or "x>15" then

display 'Error'


end






Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS