Professional Documents
Culture Documents
Programming 1 Semester Assignment: Faculty of Information Technology
Programming 1 Semester Assignment: Faculty of Information Technology
PROGRAMMING
1ST SEMESTER ASSIGNMENT
TOTAL MARKS 10
TOTAL MARKS FOR ASSIGNMENT 100
Examiner’s Comments:
Moderator’s Comments:
1|Page
Table of Contents
Question 1: .............................................................................................................................................. 3
Question 3: .............................................................................................................................................. 8
Bibliography .......................................................................................................................................... 10
2|Page
Question 1:
Coding:
Public Class Form1
TextBox5.Text = CInt(sum)
Catch ex As System.InvalidCastException
MessageBox.Show("Please enter a number",
"Error")
End Sub
ComboBox2.Items.Add("10")
3|Page
ComboBox2.Items.Add("15")
ComboBox2.Items.Add("20")
ComboBox2.Items.Add("25")
ComboBox2.Items.Add("30")
ComboBox2.Items.Add("35")
ComboBox3.Items.Add("10")
ComboBox3.Items.Add("15")
ComboBox3.Items.Add("20")
ComboBox3.Items.Add("25")
ComboBox3.Items.Add("30")
ComboBox3.Items.Add("35")
ComboBox4.Items.Add("40")
ComboBox4.Items.Add("40,5")
ComboBox4.Items.Add("41")
ComboBox4.Items.Add("41,5")
ComboBox4.Items.Add("42")
ComboBox4.Items.Add("42,5")
ComboBox4.Items.Add("43")
ComboBox4.Items.Add("43,5")
ComboBox4.Items.Add("44")
ComboBox4.Items.Add("44,5")
ComboBox4.Items.Add("45")
ComboBox4.Items.Add("45,5")
ComboBox4.Items.Add("46")
ComboBox4.Items.Add("46,5")
ComboBox4.Items.Add("47")
ComboBox4.Items.Add("47,5")
ComboBox4.Items.Add("48")
ComboBox4.Items.Add("48,5")
ComboBox4.Items.Add("49")
ComboBox4.Items.Add("49,5")
ComboBox4.Items.Add("50")
End Sub
4|Page
Question 2:
Coding:
Private Sub displayBtn_Click(sender As Object, e As EventArgs) Handles displayBtn.Click
End If
End Sub
Sub CalculateDDB(ByVal asset As Double, ByVal salvageValue As Double, ByVal yearsAs Int32)
5|Page
Dim ddbalance As Double = 2 * depreciationRate
' Dim values(years - 1) As Double
Dim firstYearValue = asset * (ddbalance / 100)
End Sub
End Class
Coding:
Public Class Form1
If (result.Equals(DialogResult.Yes)) Then
Me.Close()
Else
6|Page
End If
End Sub
7|Page
Question 3:
End Sub
For i As Integer = 0 To 5
Dim LI As New ListViewItem
'LI.SubItems.Add(data(0, 0))
For j As Integer = 0 To 3
If j = 0 Then
LI.Text = data(i, j)
Else
Dim total = m.Sum()
Console.WriteLine(m.Sum)
Console.WriteLine("First one" & m(j - 1) / total)
Dim perc = Format(m(j - 1) / total, " (0.00%) ")
8|Page
Dim ff As New Font(LI.SubItems(0).Font, FontStyle.Regular)
LI.SubItems(0).Font = ff
End If
Next
lv.Items.Add(LI)
'lv.Items(i).ListView.Font = New Font(lv.Items(i).ListView.Font,
FontStyle.Bold)
' lv.Items(0).SubItems(0).Text = data(0).
Next
'ListBox1.Items.Add("Month" & vbTab & vbTab & "Kwazulu-Natal sales(R)" & vbTab
& vbTab & "Gauteng sales(R)" & vbTab & vbTab & "Western cape sales(R)")
'ListBox1.Items.Add("1" & vbTab & vbTab & vbTab & "120,000" & vbTab & vbTab &
vbTab & "90,000" & vbTab & vbTab & vbTab & "65,000")
'ListBox1.Items.Add("2" & vbTab & vbTab & vbTab & "190,000" & vbTab & vbTab &
vbTab & "85,000" & vbTab & vbTab & vbTab & "64,000")
'ListBox1.Items.Add("3" & vbTab & vbTab & vbTab & "175,000" & vbTab & vbTab &
vbTab & "64,000" & vbTab & vbTab & vbTab & "71,000")
'ListBox1.Items.Add("4" & vbTab & vbTab & vbTab & "188,000" & vbTab & vbTab &
vbTab & "83,000" & vbTab & vbTab & vbTab & "67,000")
'ListBox1.Items.Add("5" & vbTab & vbTab & vbTab & "125,000" & vbTab & vbTab &
vbTab & "87,000" & vbTab & vbTab & vbTab & "65,000")
'ListBox1.Items.Add("6" & vbTab & vbTab & vbTab & "163,000" & vbTab & vbTab &
vbTab & "80,000" & vbTab & vbTab & vbTab & "64,000")
End Sub
End Sub
End Class
(Kiong, 2010)
9|Page
Bibliography
Kiong, D. V. (2010, March). VBTutor. Retrieved from
https://www.vbtutor.net/vb2013/vb2013tutor.html
10 | P a g e