DISC 3371 Fall 2007 Parks Midterm Answers

DISC Department Course Search

Search for:
  

Search Course Numbers & Titles Only
Search Course Descriptions Only
Search Both
1. (50 points) The search page to the left allows a user to search the DISC department's undergraduate course listing. The page contains:
  • a form named f1
  • a textbox named s is provided for the user to enter the string for which they wish to search.
  • three radio buttons to define the type of search
  • a button labeled "SEARCH" that calls the sub p1 when clicked.
  • a DIV block with id="sr" is provided at the bottom of the page.

In a sub named p1, the course information is stored in two arrays -- both containing 46 elements. The array c contains the course number and the course title; and the array d contains the course descriptions.

This is the sr DIV block
For example, the first 4 courses in the list of 46 courses in arrays c and d are shown below:

c(1)="3300: Introduction to Computers and Management Information Systems (formerly DISC 2373)"
d(1)="Cr. 3. (3-0). Fundamental concepts of information systems used in business including the use of computer tools to aid in business decision making."
c(2)="2373: Introduction to Computers and Management Information Systems"
d(2)="Cr. 3. (3-0). Prerequisite: sophomore standing. Use of computers in the business environment. Special attention given to systems operations, programming, and applications."
c(3)="3301: Service and Manufacturing Operations"
d(3)="Cr. 3. (3-0). Prerequisite: MATH 1313. An overview of operations management concepts and techniques. Operations management strategy, total quality management, location and layout, forecasting, aggregate planning, materials management, just-in-time systems, scheduling, and project management in small and multinational manufacturing and service organizations are addressed."
c(4)="3331: Statistical Analysis for Business Applications I"
d(4)="Cr. 3. (3-0). Prerequisites:MATH 1313-MATH 1314, and credit for or concurrent enrollment in DISC 3300. Random variables and their probability distributions; sampling distributions; point and interval estimation; hypothesis testing; correlation and linear regression."
...
Assume these two 46 element arrays are defined in p1.
The form f1 also contains three radio buttons that allow the user to indicate the type of search to be performed:

  1. If the first radio is checked, ONLY the course numbers/titles are searched (i.e., the array c)
  2. If the second radio is checked, ONLY the course descriptions are searched (i.e., the array d)
  3. If the third radio is checked, the course numbers/titles AND the course descriptions are searched (i.e., both the the array c and the array d are searched)
When p1 is executed, the search string is retrieved and the array (or arrays) are searched based on the radio button chosen. For all courses containing the desired search string, the course number/title is displayed as well as the course description in the sr DIV block -- regardless of the type of search (i.e., regardless of the radio button chosen, when a match is made with the search string, display BOTH parts: course number/title AND the description). The courses found should be numbered, each displayed on new line, and the total number of courses found reported at the end. The search in case insensitive (i.e., upper and lower case DO NOT MATTER). Using VBScript write ONLY the sub named p1. Show NO HTML.
 

 

BRICKS AND MORTAR

Bricks are:
Brick Height (bh) in pixels
Brick Width (bw) in pixels
Mortar Joint Width (mj) in pixels

The Wall is:
Number of Courses (i.e., rows)(nc)
Number of Bricks per Course (nb)

(Two character names in bold above are the variable names to be used in p2)

2. (50 points) The web page shown to the left contains the necessary information to create an image of a brick wall. Two gif images (brick2.gif and mortar.gif) are available to create the image. The user specifies: (1) the size of a brick (in pixel height and width to be drawn by stretching the brick2.gif image) and (2) the thickness of the mortar joint between the bricks (in pixel height/width to be drawn by stretching the mortar.gif image).

When the user fills in the data fields and clicks the "go" button, a javascript function named p2 is executed. This function retrieves the user parameters and creates a page on-the-fly that displays the brick wall by using a table with cellspacing="0", cellpadding="0" and border="0". The table is constructed so that:

  • each table row has only one table cell composed of adjacent gif images
  • each row is (bw+mj)*nb pixels wide AND each row is bh pixels tall
  • three types of rows are produced:
    • (a full brick start) a row beginning with a single half-wide mortar joint, followed by nb full bricks (bh pixels tall, bw pixels wide, brick2.gif in color) separated by full mortar joints (mortar.gif in color, mj pixels wide), followed by a single half-wide mortar joint.
    • (a mortar joint) a full horizontal mortar joint (mortar.gif in color, mj pixels high and
      (bw+mj)*nb pixels wide)
    • (a half brick start) a row beginning with a half-wide brick, followed by (nb-1) full bricks separated by full mortar joints, followed by half brick
Rows types should alternate: A,B,C,B,A,B,C,B,A,B,... until nc brick rows (types A and types C) are produced. Show no HTML. Write only the javascript for p2. Perform NO data edits.