If Any Web Resources Required.: Sub Dim As New
If Any Web Resources Required.: Sub Dim As New
If Any Web Resources Required.: Sub Dim As New
Practical No 17
XIV. Exercise
1. Write a program to identify Volume of Box Class, with three data members, length,
breadth and height.
Module Module1
Sub Main()
Dim obj As Box = New Box()
Dim vol As Integer
vol = obj.volume(2, 4, 4)
Console.WriteLine("Length =" & obj.l)
Console.WriteLine("Breadth =" & obj.b)
Console.WriteLine("Height =" & obj.h)
Console.WriteLine("Volume =" & vol)
Console.ReadLine()
End Sub
Class Box
Public l, b, h As Integer
Function volume(ByVal i As Integer, ByVal j As Integer,
_ByVal k As Integer)
Dim v As Integer
l = i
b = j
h = k
v = l * b * h
Return v
End Function
End Class
End Module
Output:
2. Implement a program to accept values from Combo Box and Display average of this in
message box using class.
ComboBox2.Items.Add(6)
ComboBox2.Items.Add(11)
ComboBox2.Items.Add(17)
ComboBox2.Items.Add(24)
ComboBox2.Items.Add(36)
End Sub
OUTPUT: