Description
CST8110 – Introduction to Programming
Lab Exercise #6 – for statement
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
**
CST8110 – Lab Exercise 6 – for statement 1 of 1
Reviews
There are no reviews yet.