DISC 3371 -- Fall 1999 -- Parks -- Examinations answers 10/26/99

1 (40 points) Given the following table (NOT frames):

Captain Webb's Pizza
 Number of Pizzas

Size:   6"   8"   12"

  Pick-up  Delivered   Zip Code  
  Thin Crust  Thick Crust  
Ingredients
 

  

 

Pepperoni
Sausage
Beef
Onions
Peppers
Mushrooms
Extra Cheese
Pineapple
Olives
Shrimp
This code works -- click "View Source" to see it

Show the HTML and VBScript necessary to calculate the price of the pizza order. Small pizzas (6") are $6.00, medium (8") are $8.00 and large (12") are $10.00. Each added ingredient increases the price $0.50 (i.e., for every ingredient box checked, add $0.50). Pizzas that are "picked up" have zero delivery charges. Delivery is free if the zip code is 77204 otherwise delivery is $0.75 per pizza. When the user presses the "Calculate Price" button, show the total price of the order in the textbox in the lower right corner (i.e., take the price of the pizza (based on size), add $0.50 per ingredient and multiply by the number of pizzas ordered, then add delivery cost if necessary). Name: the form fred; the textbox for quantity pq; the zip code box zc; the delivery radios dr; the crust radios cr; the size radios sz; the ingredient checkboxes c1 thru c10; the "Calculate Price" button cp and the price textbox pt. Thick and thin are the same price. Do NOT edit,validate or check the users' entries.

2. (60 points) Given the following three frames:

Lost Your Keys?
Enter Your 18-digit Purchase ID Number and Your Phone Number.
Then click the GO button to receive information on how to get a copy of your keys
Purchase ID
Customer 10 digit Phone Number
The boxes and buttons above are for display purposes only Click here for the answer to problem #2

    A subroutine named check is part of the bottom frame and contains a ten element array named codes which contains the 10 two character codes: "14"; "Z4"; "V5"; "U7"; "M2"; "T2"; "F8"; "H2"; "G7"; "S3".
    The Purchase ID was created for each owner by taking the 8 character string "W9312356" and adding ten additional characters for a total of eighteen characters. This 10 character string is composed of five two character strings from the array codes. The five values in codes are chosen by using the last five digits of the customer's phone number to locate the appropriate strings in codes (e.g., if the purchaser's phone number was 7135501234, then the last five digits "01234" would correspond to the locations in codes 0,1,2,3,and 4. The ten characters string created would be "14Z4V5U7M2" (i.e., the codes values for 0 which is "14", "Z4" for 1, "V5" for 2, "U7" for 3, and "M2" for 4).
    When the user clicks the "GO" button, the check routine should validate the two parts of the Purchase ID number: (1) The first 8 characters of the Purchase ID must be "W9312356"; and (2) the last ten characters of Purchase ID must be the five codes values associated with the last five digits of the Customer's Phone Number. If the Purchase ID passes both these tests, then in the middle frame write the message "Call 800-555-8789 for replacement directions." otherwise write "Your info is not valid".
    Show the HTML and VBScript to perform this task. Name: the top level frame t1.htm; the three frame pages should be named t2.htm; t3.htm; t4.htm; the form name for the middle frame is t3form; and the Purchase ID is named pid and the Phone Number is named pnum. Assume no spaces or hyphens appear in the phone number. Do NOT edit the input data -- assume eighteen characters will be entered for the ID and ten numeric characters for the Phone Number.