Lab Exercise #6 – for statement solution

$9.99

Original Work ?
Category:

Description

5/5 - (1 vote)

Write a program (method main) to solve the following problem: We want to display a box of stars of a given length and width.
BONUS: add editing so that only length of 0-20 can be entered, and width can only be 0-20. (Don’t need to add handling for alphabetic entry yet).
Example 1: (blue is entered by user) Enter the length: 6 Enter the width: 4
**** **** **** **** **** ****
Example 2: Enter the length: 21 Invalid – enter length between 1 and 20: -1 Invalid – enter length between 1 and 20: 1 Enter the width: 21 Invalid – enter width between 1 and 20: 2