Callyn Naidoo - Programing 511
Callyn Naidoo - Programing 511
Callyn Naidoo
Templet
Assignment
3
Contents
Question One:.......................................................................................................................................4
GUI:....................................................................................................................................................4
CODE:................................................................................................................................................4
Running Program:..............................................................................................................................5
Drop down list:..................................................................................................................................6
Question Two:.......................................................................................................................................7
GUI:....................................................................................................................................................7
CODE:................................................................................................................................................7
Running Program:..............................................................................................................................9
Question Three:...................................................................................................................................10
GUI:..................................................................................................................................................10
CODE:...............................................................................................................................................10
Running Program:............................................................................................................................14
4
Question One:
GUI:
CODE:
Public Class Form1
'variable declaration
'closing form
Me.Close()
End Sub
5
nlength = CInt(cmblength.Text)
nwidth = CInt(cmbwidth.Text)
nheight = CInt(cmbheight.Text)
nrollcov = CDbl(cmbrollcov.Text)
'displaying answer
txtsingleroll.Text = CStr(Math.Ceiling(ntotal))
End Sub
End Class
Running Program:
6
Question Two:
GUI:
CODE:
Public Class Form1
8
'Variable declaration
nassestcost = CDbl(txtassest.Text)
nsalvagevalue = CDbl(txtsalvage.Text)
nusefullife = CInt(cmbuseful.Text)
'Loop begins
'Calculation
'Loop ends
Next
End Sub
'Closing Form
Me.Close()
End Sub
End Class
Running Program:
10
11
Question Three:
GUI:
CODE:
Public Class Form1
'Array declaration
'Variable declaration
End Sub
'Array value
salesarray(1, 1) = 120000
salesarray(2, 1) = 190000
salesarray(3, 1) = 175000
salesarray(4, 1) = 188000
salesarray(5, 1) = 125000
salesarray(6, 1) = 163000
salesarray(1, 2) = 90000
salesarray(2, 2) = 85000
salesarray(3, 2) = 80000
salesarray(4, 2) = 83000
salesarray(5, 2) = 87000
salesarray(6, 2) = 80000
salesarray(1, 3) = 65000
salesarray(2, 3) = 64000
salesarray(3, 3) = 71000
salesarray(4, 3) = 67000
salesarray(5, 3) = 65000
salesarray(6, 3) = 64000
counter = 0
nkzntotal = 0
ngtotal = 0
nwctotal = 0
nloopcontrol = 0
Do Until nloopcontrol = 6
counter = counter + 1
getvaluekzn = salesarray(counter, 1)
getvalueng = salesarray(counter, 2)
getvaluewc = salesarray(counter, 3)
'Controls the loop to end after getting all the value out of the array
nloopcontrol = nloopcontrol + 1
Loop
End Sub
'Closing form
Me.Close()
End Sub
End Class
15
Running Program: