<%@LANGUAGE="VBSCRIPT" %> <% Response.CacheControl = "no-cache" %>
Project 1

Objectives

  • Apply knowledge of HTML Controls to a project scenario.
  • Learn about visibility properties of HTML Controls.
  • Apply knowledge of the logical operators AND and OR.
  • Learn to calculate the decimal (base 10) value of an 8-bit binary (base 2) number.
  • Learn to Logical AND and Logical OR two 8-bit binary numbers.
  • Learn to bitwise AND and bitwise OR two 8-bit binary numbers.

Background

Binary numbers are made up of 0 and 1. An example of a binary number would look like: 10010111
This is an example of an 8-bit binary number. A 16-bit binary number would look like: 1001001011011001
This project deals with 8-bit binary numbers. The decimal value of 10010111 is not 10,010,111. It is actually 151 as a base 10 numeric value.
How is it calculated?
Binary numbers count from right to left. Each digit to the left is twice the value of its digit to the right. A graphical representation of this would look like this:

128
64
32
16
8
4
2
1
               

Hence, a 1 in the 128 box gives the binary number a decimal value of at least 128.
Some Examples:

Binary Number   Decimal Value
10000000 = 128
10000001 = 129
00000000 = 0
00000001 = 1
00000010 = 2
00000011 = 3
00000100 = 4
00000101 = 5
11111111 = 255

Thus, 0 to 255 offers 256 values within an 8-bit binary number.

Bitwise AND (&)
How to bitwise AND binary values together:

10010010 & 01101101 = 00000000
10010010 & 01111101 = 00010000
01010101 & 01010101 = 01010101

Bitwise AND requires two operands, just like a logical AND. Bitwise AND is represented by a single ampersand, &, whereas a logical and is represented by a double ampersand, &&. How does it work? Use a logical AND to compare each of the bits against each other, starting from the right.

10101010
11001100

_______0

Only when both numbers are a 1, will the result be a 1. Otherwise, the result is 0.

10101010
11001100

____1000

and so on...

Bitwise OR ( | )
How to bitwise OR binary values together:

10010010 | 01101101 = 11111111
10010010 | 01010000 = 11010010
01010101 | 00000111 = 01010111

Bitwise OR is represented by a single | (pipe) whereas a logical OR is represented by a double pipe, ||. How does it work? Use a logical OR to compare each of the bits against each other, starting from the right.

10010010
01101101

_______1

When either bit or both bits are a 1, then the result is a 1.

10010010
01010000

___10010

Bitwise XOR
There is another bitwise operator, XOR, which is an abbreviation for eXclusive OR. It works like this: When either bit is a 1, then the result is a 1, but if both bits are a 1 or if both bits are a 0, then the result is a 0.

10010010
01010000

11000010

Requirements

Create an aspx of this general form:

=
                 
=
                   
 
Bitwise result:
     

However:
Initially, only one text field and one select box will be visible to the user.

              =

And once a value is chosen, the decimal value is calculated and stored in the result box to the right. Also, the next select box will then appear.

            =

And the process repeats from there, thus the next selection would look like:

          =

After the eighth and final bit value is chosen, again, the decimal value of the 8-bit number would be calculated and stored, and a different select box would appear below.

=
                 

At this point, you would then choose whether to bitwise AND (&) or to bitwise OR ( | ) these two 8-bit numbers together. Upon choosing one, the next line begins to appear and the process repeats itself.

=
                 
              =

Upon choosing the eighth and final bit of the second 8-bit number, again, the decimal value of the 8-bit number would be calculated and stored, and a final row of the table would appear. This final row would contain the bitwise result of the two 8-bit numbers you have selected.

=
                 
=
                   
 
Bitwise result:
     

Grading
If the project is not functional (does not work), then your project grade starts at 50%. This is a professional project; our company will not accept partial work. Late work will not be accepted. (In the real world, you would not get paid for a project you did not complete. In our world, you start at 50%)

  • 20% Aesthetics
    • (Professional, originality, creativity, etc. -- More than just form elements -- CSS, look 'n' feel, etc.)
  • 65% Coding & Logic
    • (Does not crash, proper indentation, neatness, free from errors, correct logic, security, follows typical coding standards, apparent planning, etc.)
  • 15% Commenting
    • (In general, one line of comment per line of code)