Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Gramin Technical and Management Campus

Department of computer engineering


Subject/code: -GAD/22034

Name:-suyash telang Batch:- B Roll no:- 41

DOP: DOS:-

1. Coding:-
PublicClassForm1
ClassBox
Public length AsDouble
Public breadth AsDouble
Public height AsDouble

PublicFunction Volume() AsDouble


Return length * breadth * height
EndFunction
EndClass

PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs)


Handles Button1.Click
Dim myBox AsNewBox()

myBox.length = Double.Parse(InputBox("Enter the length of the box:", "Box Volume"))


myBox.breadth = Double.Parse(InputBox("Enter the breadth of the box:", "Box Volume"))
myBox.height = Double.Parse(InputBox("Enter the height of the box:", "Box Volume"))

Dim boxVolume AsDouble = myBox.Volume()

MsgBox("The volume of the box is "& boxVolume &" cubic units.",


MsgBoxStyle.Information, "Box Volume")

EndSub
EndClass
Output:-

2.Coding:-

PublicClassForm2
ClassComboAverage
Private values AsNewList(OfDouble)

PublicSub AddValue(ByVal value AsDouble)


values.Add(value)
EndSub

PublicFunction GetAverage() AsDouble


If values.Count = 0 Then
Return 0
Else
Dim total AsDouble = 0
ForEach value AsDoubleIn values
total += value
Next
Return total / values.Count
EndIf
EndFunction
EndClass

PrivateSub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVale


As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
EndSub

PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs)


Handles Button1.Click
Dim comboAvg AsNewComboAverage()

Dim input AsString = InputBox("Enter values separated by commas:", "Combo Box


Average")
Dim values AsString() = input.Split(",")
ForEach value AsStringIn values
comboAvg.AddValue(Double.Parse(value))
Next

Dim avg AsDouble = comboAvg.GetAverage()

MsgBox("The average of the values is "& avg, MsgBoxStyle.Information, "Combo Box


Average")

EndSub
EndClass

Output:-

You might also like