'This file is named rectangle.vb Imports System Imports Microsoft.VisualBasic Public Module MyRectangle Sub Main() Dim rows, cols, i, j As Integer System.Console.WriteLine("This program was written by Kevin Jones (DCC, CA 121, 062)") System.Console.WriteLine() System.Console.WriteLine() System.Console.Write("Enter number of rows (between 1 and 25): ") rows = System.Console.ReadLine() While rows < 1 or rows > 25 System.Console.Write("Sorry, that is not acceptable. Try again. ") rows = System.Console.ReadLine() end while System.Console.Write("Enter number of columns (between 1 and 79): ") cols = System.Console.ReadLine() While cols < 1 or cols > 79 System.Console.Write("Sorry, that is not acceptable. Try again. ") cols = System.Console.ReadLine() end while 'Draw top line For j = 1 to cols System.Console.Write("*") Next j System.Console.Writeline() 'Draw (rows - 2) middle lines For i = 1 to rows - 2 'Draw left line System.Console.Write("*") 'Draw spaces for middle columns For j = 1 to cols-2 System.Console.Write(" ") Next j 'Draw right line If cols > 1 Then System.Console.Write("*") System.Console.Writeline() Next i 'Draw bottom line If rows > 1 Then For j = 1 to cols System.Console.Write("*") Next j System.Console.Writeline() End If System.Console.WriteLine() System.Console.WriteLine("Program terminating...") End Sub End Module