0% found this document useful (0 votes)
43 views2 pages

Android Practical 17

This document contains code for calculating the volume of a rectangular prism and averaging three numbers. It defines a Calculator class with methods to get length, breadth, and height input from the user and calculate the volume. It also defines an Average class with a method to sum three input numbers and divide by three to get the average. The main method calls the Calculator methods to get and output the volume. The button click event handler calls the Average method to get and display the average of three combo box selections.

Uploaded by

Faiz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

Android Practical 17

This document contains code for calculating the volume of a rectangular prism and averaging three numbers. It defines a Calculator class with methods to get length, breadth, and height input from the user and calculate the volume. It also defines an Average class with a method to sum three input numbers and divide by three to get the average. The main method calls the Calculator methods to get and output the volume. The button click event handler calls the Average method to get and display the average of three combo box selections.

Uploaded by

Faiz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Imports System

Module Module1
Public Class calculator
Dim l, b, h As Integer
Dim v As Integer
Function getdata()
Console.WriteLine("Enter Length, Breadth and height")

l = Console.ReadLine()

b = Console.ReadLine()

h = Console.ReadLine()

End Function
Function volume()
v = l * b * h
Return v
End Function
End Class
Sub main()
Dim a As Integer
Dim v1 As New calculator
v1.getdata()
a = v1.volume
Console.WriteLine("Volume:" & a)
Console.ReadKey()
End Sub
End Module
Public Class Form1

Class Average
Dim x, y, z As Integer

Dim avg As Integer

Dim total As Integer

Public Function Average(ByVal x As Integer, ByVal y As Integer, ByVal z


As Integer)

total = Val(x) + Val(y) + Val(z)

avg = total / 3

Return avg

End Function
End Class

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
Dim a1 As New Average()
Dim A = a1.Average(ComboBox1.SelectedItem, ComboBox2.SelectedItem,
ComboBox3.SelectedItem)

MsgBox("Average = " & A)


End Sub
End Class

You might also like