CMPSC 204
Visual Basic Program II
Fall 2004
Project: the Hall Light
Project in Visual Basic
Project 2: The
Hall Light Project
Consider the Hall
light system that exists in most modern houses.
If both switches are on or if both are off, the hall light is off. If one is up and the other is down, the hall
light is on. This logic is called an
Exclusive Or, commonly abbrieviated
as: XOR. In order for the logical
expression: A XOR B to be true, either A or B must be true, but not both.
Write a program that
will input the state of the two switches and shows a light image that is ON and
one that is OFF to tell the user whether the hall light is on or not.
Instructions:
1. As shown in class, open Visual Basic and
Create a new project.
2. You are to read the project in the book carefully and translate it
into a VB application.
3. Use two buttons for the switches ON/OFF. You can make them graphic if you want, with
colors and pictures, but you must at least have the captions change to ON or
OFF when they are clicked.
4. You must have a pic box with a picture of a
light turned on and another pic box with a picture of
a light turned off. Make one of these
visible when the light is on, and the other visible
when the light is off.
What to turn in:
1. Create a drawing of your application on graph paper.
2. Using the File/Print menu option, print the code and at least 2
screenshots of your running application.
3. Hand in all three items described above on paper, no e-mails, no
disks.