DISC 3371 FINAL EXAM
SPRING 1999 Parks

1. (40 points) Given the following html page composed of a frameset with three frame rows:

Compute My Local School Tax
Adjusted Gross Income Number of Dependents
Filing Status: Married Single
Enter Itemized Deductions or Check here for the Standard Deduction
My Tax is $ 0.00
CAUTION: This table is for printing only. See working code below

When the user presses the "Compute My Tax" button the VBscript should compute the tax in two steps:
  1. Compute Taxable Income. If the user checked the Standard Deduction Box, then
       Taxable Income = Adjusted Gross Income - (2,750.0) times (Number of Dependents + 1)
    if the user did not check Standard Deduction, then
       Taxable Income = Adjusted Gross Income - Itemized Deductions
  2. then Tax is computed based on Filing Status. If Married,
       Tax = Taxable Income * 0.0034
    if Filing Status is Single, then,
       Tax = Taxable Income * 0.0028
Show the value of Tax in the bottom frame (this frame must be created on-the-fly). Use a function named checknum to assure that only the digits 0 through 9 are entered into the fields: Adjusted Gross Income, Number of Dependents, and Itemized Deductions. The function should return a value of zero if there is no error and a value of 1 if an error is detected. The program should use this value returned from checknum to display an error message if appropriate.

ANSWER:

Click here for the working answer.

The frame structure at the top is in href above. It contains:

<html>
<frameset rows="150,50,*">
 <frame src="s9937fg1.htm">
 <frame src="s9937fg2.htm">
 <frame src="s9937fg3.htm">
</frameset>
</html>

When viewing the working answer, right click in the frame, then "View Source"

2. (60 points) Given the following 2 row 2 column frameset:





How many angels can stand on the head of a pin?

My Answer is

 

out of 5 correct

CAUTION: This table is for printing only. See working code below

The left top frame contains the five question in the array q(5). Given:

   q(0)="How many angels can stand on the head of a pin?"
   q(1)="How many judges on the Supreme Court?"
   q(2)="Number of lifeboats on Titantic?"
   q(3)="Number of sides in a pentagram?"
   q(4)="Number of US states that begin with the letter M?"

When one of the five question buttons is clicked, the right top frame is created with: (1) the question text; (2) a two digit field for the answer (named myanswer); and (3) a hidden variable named qnum. The bottom right frame contains the button "Store my Answer". When the user clicks this button, their answer value in the top right frame (i.e., myanswer) is stored in one of five hidden variables in the left bottom frame. These five hidden variables in left bottom frame are named: user0, user1, user2, user3, and user4. Use the value of qnum to determine which hidden variable gets the answer. This left bottom frame also contains the correct answers to the five questions in a five element array named ans. Values for this array are: ans(0)=7, ans(1)=9, ans(2)=24, ans(3)=5, and ans(4)=17. Anytime the user clicks the "Grade My Questions" button, the values of usr0, usr1, .... etc. are compared to the correct answers in the array named ans and the number of correct answers is shown in the text box in the left frame. Perform no editing of the data. The top right side frame is initially blank.

ANSWER

Click here for the working answer.

The top level frame structure (the one linked above) is:

<html>
<frameset rows="250,*">
    <frame src="s9937ft0.htm">
    <frame src="s9937ft1.htm">
  </frameset>
</html>

Then the ...ft0.htm is:

<html>
<frameset cols="200,*">
    <frame src="s9937fta.htm">
    <frame src="s9937ftb.htm">
</frameset>
</html>  

and, the ...ft1.htm is:

<html>
<frameset cols="200,*">
    <frame src="s9937ftc.htm">
    <frame src="s9937ftd.htm">
  </frameset>
</html>

So you get:

..fta.htm..ftb.htm
..ftc.htm..ftd.htm

When viewing the working answer, right click in the frame, then "View Source"