comments 6

Carpet Size Design Document
CISC 186 Visual Basic Programming
Fall 2011
Student Name
Purpose:
Input:
Process:
Output:
Calculate a room’s area in square feet to determine how much carpet is needed to cover
a room’s floor.
User will input the length and the width of the room.
Once the data is entered, the program will calculate the area of the room by multiplying
the length X the width of the room.
Once the program executes the algorithm, the program will display the total area in
square feet of the room.
Carpet Size Calculator Program Design
Length of Room:
Width of Room:
Don't use all CAPITAL LETTERS
CALCULATE
RESET
Total Area in ft²:
0’
EXIT
Carpet Size Calculator Controls
Control Type
Control Name
Form
(Default)
Label
Label
Label
Label
(Default)
(Default)
(Default)
lblResult
Text Box
txtLengthInput
Text Box
txtWidthInput
Button
btnCalculate
Button
btnReset
Description
A # by # pixel window that will serve as a form that will
display labels, text boxes and buttons.
This label will display the title “Length of Room”
This label will display the title “Width of Room”
This label will display the title “Total Area in ft²”
This label will display the result of the performed
calculation.
This text box will serve as an input area where the user
will enter the length of the room.
This text box will serve as an input area where the user
will enter the width of the room.
This button will execute the algorithm to calculate the
total area of a room.
This button will clear all data from “txtLengthInput”,
“txtWidthInput” and “lblResult”.
Button
btnExit
Carpet Size Calculator Control Values
Control Type
Control Name
Form
(Default)
Label
(Default)
Label
(Default)
Label
(Default)
Label
lblResult
Text Box
txtLengthInput
Text Box
txtWidthInput
Button
btnCalculate
Button
btnReset
Button
btnExit
This button will terminate the application.
Text Property
“Carpet Size Calculator”
“Length of Room”
“Width of Room”
“Total Area in ft²”
“0’” in Bold.
“Calculate”
“Reset”
“Exit”
Carpet Size Calculator Event Handlers
Event Handler Name
Description
btnCalculate_Click
Gathers entered data from “txtLengthInput” and “txtWidthInput” and
multiplies it. It then stores the data in a variable, then formats the result into
the right format and appears on “lblResult”.
btnReset_Click
Erases data from text boxes “txtLengthInput”, “txtWidthInput” and label
“lblResult”.
btnExit_Click
Terminates the application.
Flowchart for the btnCalculate_Click Handler
Start
If data entered in
numbers larger than 0,
then multiply
txtLengthInput times
txtWidthInput and
store the result in
dblResult, if not, then
prompt user to enter
data in numbers larger
than 0.
We will learn about If
statements and the flowchart
diagram for If statements in a
later chapter.
Store the value of
dblResult in the
lblResult text
property.
End
Flowchart for the btnReset_Click Handler
Start
Clear the text property
content of
txtLengthInput,
txtWidthInput and
lblResult.
End
Flowchart for the btnReset_Click Handler
Start
Exit the application by
ending the form.
End