Server-Side Web Programming with Active Server Pages
Lab 2 - Basic ASP Output - Bingo Card Generator

 
In this lab you will create a Bingo card generator that duplicates the page below as closely as possible. The purpose of the page is so it can be printed out. There are many different styles of bingo cards, but for this assignment your ASP page should do the following:
  • Create a 5x5 grid that includes unique random numbers between 1 and 75.
  • The squares in the grid should be a fixed size so a dime could approximately fit on a printed version of the page.
  • No number can appear twice on a card.
  • The center square of the card should be marked as "FREE" instead of with a number and shaded with the color #33FF00.
  • The numbered squares should be square-shaped, not a rectangle.
  • Squares should be shaded in a checkerboard fashion with the color #FFCCCC when a square's row and column are both odd numbers OR both even numbers.
  • The first row should spell out BINGO in each column using H1 elements and the font color #009900.
  • The page should support all browsers using HTML version 3.2 or above.

Lab 2 Graphic

Create this page in your child web (or move it there if you create it outside of class) in a directory named "Lab02" and name the page "default.asp".  Be sure to include your name and student ID as META elements in the page. Use the ASP Template as a start.

This assignment is worth 15 points. Your page should be completed and date stamped no later than Saturday, September 16th by 11:59p.m. When you have completed the page, send an e-mail to Chris Allen indicating you are done (Subject line should be: "CSC123, Lab 2, [Your Name]") and include a URL to your page. Do not change the web page after that time, as the file timestamp will change and the lab will be considered late.

The logic for creating the Bingo numbers is provided below as a function. You should include the function and the declarations in your page (you are welcome to create your own function if you want). You will also need to create a function to determine if a number is odd or even--think about using VBScript's MOD operator or FIX function.

'Page declarations
Const cSIZE = 75 'Regulation Bingo is 1 - 75
Const cCARD = 5 '5x5 Bingo Card
Const cCNTR = 3 '>>Free<<
Const cWIDTH = 45 'Width of Cell
Dim sUsedNumbers 'List of Used Bingo Numbers
Function NextNumber() 'As Integer

      Dim iRET 'As Integer

      Dim F 'As Boolean
      Dim i 'As Integer
      Dim S 'As String

      F = True
      S = ""
      iRET = -1
      
      For i = 1 To cSIZE
            S = trim(cstr(i))
            S = String(4 - Len(S), "0") & S
            If InStr(sUsedNumbers, S) = 0 Then
                  F = False
                  Exit For
            End If
      Next
      
      While Not F
            iRET = Int(Rnd * cSIZE) + 1
            S = trim(cstr(iRET))
            S = String(4 - Len(S), "0") & S
            If InStr(sUsedNumbers, S) = 0 Then F = True
      Wend

      If iRET > 0 Then sUsedNumbers = sUsedNumbers & S & "."
      
      NextNumber = iRET
      Exit Function

End Function

Valtara Digital Design  http://www.valtara.com/csc123/   
Copyright 1999, 2001, Valtara Digital Design, Blitzkrieg Software