vb.net programming (44)

advertisement
6 Pages
VB.NET PROGRAMMING (44)
KEY
Regional – 2010
Judges/Graders:
Please double-check and verify all scores!
Property of Business Professionals of America.
May be reproduced only for use in the Business Professionals of America
Workplace Skills Assessment Program competition.
VB.NET PROGRAMMING
KEY
REGIONAL 2010
PAGE 2 of 6
Application
Scoring the form:
• 2 combo boxes (10 points each)
Label
______(20)
• Label to display the extracted cost
• Label to display the Group Class
• Title Bar Text
• Heading Label
• Label with “Programmer “contestant number in lower right
Command Buttons
______(10)
______(10)
______(10)
______(10)
______(10)
• Command Button to Calculate the cost
• Command Button to Clear and Initialize Controls
• Command Button to Exit the Program
Total Points for Scoring the Form:
______(10)
______(10)
______(10)
______(100)
Scoring the code:
• The Text file is read and populates the 2 arrays
• The combo boxes were populated from the tables
• Each sub routine documented
• The project is documented (above option strict)
• Standard prefix naming conventions
Total Points for Scoring the Code:
______(20)
______(20)
______(20)
______(20)
______(20)
______(100)
Scoring the Execution
• The correct cost is extracted from the cost grid and displayed in the correct label
______(50)
• Cost Label formatting is correct
• Option Strict is set on
• Clear routine clears text box, comboBoxes, sets focus
• Exit button works
• Contestant form looks like form illustrated in test
Total Points for Scoring the Code:
TOTAL APPLICATION POINTS
______(20)
______(20)
______(30)
______(20)
______(20)
______(170)
______(370)
VB.NET PROGRAMMING
KEY
REGIONAL 2010
PAGE 3 of 6
Notes to Graders:
You should run the application from the contestant’s flash drive to verify the correct
execution.
Labels and boxes should be aligned.
Contestant Number must appear in code and on the bottom right side of the form at
time of execution
Tabbing between fields will be in logical order.
Results must not be hard-coded into the program.
SAMPLE CODING
CODING MAY NOT BE IDENTICAL TO SAMPLE.
'Application Documentation
'Programmer: Contestant Number
'Date: Month Day Year
'Description: This program calculates the cost of shipping
a package utilizing the Post Office Global Priority Mail
System
Public Class frmGPM
Dim GPM(7) As String
Dim Group(4) As String
Private Sub frmGPM_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'This module populates populates the arrays with
the data from the text file
Dim sr As System.IO.StreamReader
sr = System.IO.File.OpenText("gpm.text")
For row As Integer = 0 To 7
GPM(row) = sr.ReadLine
VB.NET PROGRAMMING
KEY
REGIONAL 2010
PAGE 4 of 6
Next
For row As Integer = 0 To 3
Group(row) = sr.ReadLine
Next
sr.Close()
'This module populates the combo boxes, then
populates the arrays with the data from the text file
' The load procedures are called to minimize code
duplication when the Clear routine is executed
Call loadweightcombobox()
Call loadClassGroupComboBox()
End Sub
Private
Sub
btnCalcualte_Click(ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
btnCalculate.Click
'bulk = weight * 1.5
'2nd class = weight * 2.25
'1st class = weight * 3.00
'Priority = weight * 3.75
Dim dblcost As Double
Dim dblweight As Double
Dim txtclass As String
Dim dblbulk As Double = 1.5
Dim dblsecclass As Double = 2.25
Dim dblfirstclass As Double = 3.0
Dim dblpriority As Double = 3.75
dblweight = cboWeight.SelectedItem
txtclass = cboClassGroup.SelectedItem
If txtclass = "Bulk" Then
dblcost = dblweight * dblbulk
Else
If txtclass = "2nd Class" Then
dblcost = dblweight * dblsecclass
VB.NET PROGRAMMING
KEY
REGIONAL 2010
PAGE 5 of 6
Else
If txtclass = "1st Class" Then
dblcost = dblweight * dblfirstclass
Else
If txtclass = "Priority" Then
dblcost = dblweight * dblpriority
End If
End If
End If
End If
lblCost.Text = dblcost.ToString
End Sub
Private
Sub
btnClear_Click(ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
btnClear.Click
'Clear the comboBoxes of selected indices
Me.cboWeight.Items.Clear()
Me.cboClassGroup.Items.Clear()
Me.lblCost.Text = ""
'Refresh the contents of the combo boxes
Call loadWeightComboBox()
Call loadClassGroupComboBox()
End Sub
Private
Sub
btnExit_Click(ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
btnExit.Click
'Exit the package cost calculation routine
End
End Sub
Private Sub loadWeightComboBox()
'Load the Weight comboBox
For intFill = 0 To 7
Me.cboWeight.Items.Add(GPM(intFill))
VB.NET PROGRAMMING
KEY
REGIONAL 2010
PAGE 6 of 6
Next
'
End Sub
Private Sub loadClassGroupComboBox()
'load group comboBox
For intFill = 0 To 3
Me.cboClassGroup.Items.Add(Group(intFill))
Next
End Sub
End Class
Download