Drawing a Rectangle??

Implement a function that draws a rectangle shape based on the given dimension. This function will take two parameters:

  • L: Length of the rectangle
  • W: Width of the rectangle

 

Conditions:

  • Output shape should be printed using the alphabets, starting with the alphabet ‘a’ on the first line, then ‘b’ on the second, ‘c’ on 3rd and so on.
  • The casing of the alphabet should change in each column (only columns). The first column will have lower case, the 2nd upper case, 3rd lower case again and so on.
  • The inside of the rectangle should be empty (fill it with spaces).

 

The function that draws the rectangle will call 2 functions to help it perform its task.

The first function will be called to handle drawing the top or bottom line. The second function will be called to draw middle lines.

(Hint: the lower and upper case asci of an alphabet character are 32 characters apart).

أضف اجابة

أضف اجابة

‫تصفح