RITIK VB - Net Assignment
RITIK VB - Net Assignment
ASSIGNMENT
ON
DOT NET TECHNOLOGY
BACHELOR OF COMPUTER APPLICATIONS
FROM
Pt. Ravishankar Shukla University Raipur (C.G)
Final Year
Year: 2022-2023
Guided by Submitted by
Mrs. Minal Chapekar Ritik Raj
(Asst.Professor) (Class BCA -3)
Submitted to
Pragati College Raipur (C.G)
24 Design the following form using horizontal scrollbar. In this, when user 55-56
click on particular scrollbar then back color of shape will be changed
to Red, Green & Blue color
25 Design the following form using vertical scrollbar. In this, when 57-58
user click on particular scrollbar then back color of shape will be
changed to Red, Green &Blue color
33 Define structure student. Structure student has data members for 79-80
storingname, rollno ,name of three subjects and marks. Write member
function
to store and print data.
34 Write a class having name Calculate that uses static overloaded 81-84
function
to calculate area of circle, area of rectangle and area of triangle.
7
35 WAP to check whether a given number is neon or not using user define 85-86
function.
36 WAP to check whether a given number is Niven or not using procedure. 87-88
42 WAP to enter any number and check whether the no. is palindrome or not. 97-98
43 WAP to calculate factorial of a number using user define procedure. 99
44 Create a class circle with data member radius; provide member function to 100-
calculate area. Define a class sphere from class circle, provide member 101
function to calculate area class cylinder from class sphere with additional
data member for height and member function to calculate volume.
8
Q.1) Write a Program to find Maximum between Three Numbers.
Program:-
Imports System
Module Module1
Sub Main()
Dim a As Integer
Dim b As Integer
Dim c As Integer
System.Console.WriteLine("Enter the Value of A =")
a = System.Console.ReadLine()
System.Console.WriteLine("Enter the Value of B =")
b = System.Console.ReadLine()
System.Console.WriteLine("Enter the Value of C =")
c = System.Console.ReadLine()
If (a > b) And (a > c) Then
System.Console.WriteLine("A is Maximum")
System.Console.ReadLine()
ElseIf (b > a) And (b > c) Then
System.Console.WriteLine("B is Maximum")
System.Console.ReadLine()
ElseIf (c > a) And (c > b) Then
System.Console.WriteLine("C is Maximum")
System.Console.ReadLine()
Else
System.Console.WriteLine("Invalid Condition")
End If
End Sub
End Module
9
OUTPUT:-
10
Q.2) Write a Program to check Whether a Number is Negative , Positive
or Zero.
Program:-
Imports System
Module Module1
Sub Main()
Dim a As Integer
System.Console.WriteLine("Enter the Value of A =")
a = System.Console.ReadLine()
If (a > 0) Then
System.Console.WriteLine("A is Positive")
System.Console.ReadLine()
ElseIf (a < 0) Then
System.Console.WriteLine("A is Negative")
System.Console.ReadLine()
End If
End Sub
End Module
OUTPUT:-
11
Q.3) Write a program to check whether a year is leap year or not.
Program:-
Module Module1
Sub Main()
Dim year As Integer
System.Console.WriteLine("Enter any Number :-")
year = System.Console.ReadLine()
If (year Mod 4 = 0 And year Mod 100 <> 0 Or year Mod 400
= 0) Then
System.Console.WriteLine("Leap Year")
System.Console.ReadLine()
Else
System.Console.WriteLine("Not Leap Year")
System.Console.ReadLine()
End If
End Sub
End Module
Output:-
12
Q.4. Write a program to check whether a character is alphabet or not.
Program:-
Imports System
Module Program
Sub Main(args As String())
Dim a As Char
Console.WriteLine("Enter Your Character : ")
a = Console.ReadLine()
Select Case a
Case "a" To "z"
Console.WriteLine("Yes! it is Alphabet : " & a)
Console.ReadLine()
Case Else
Console.WriteLine("No! It is Not an Alphabet : " & a)
Console.ReadLine()
End Select
End Sub
End Module
Output:-
13
Q.5) Write a program to find all roots of a quadratic equation.
Program:-
Module Module1
Sub Main()
Dim a, b, c, x1, x2, d As Double
System.Console.WriteLine("Enter value of a,b & c")
a = System.Console.ReadLine()
b = System.Console.ReadLine()
c = System.Console.ReadLine()
d = b * b - 4 * a * c
If (d > 0) Then
x1 = (-b + Math.Sqrt(d)) / 2 * a
x2 = (-b - Math.Sqrt(d)) / 2 * a
System.Console.WriteLine("Root 1->" & x1 & "Root 2-
>" & x2)
System.Console.ReadLine()
Else
System.Console.WriteLine("Roots are Imaginary")
System.Console.ReadLine()
End If
End Sub
End Module
OUTPUT :-
14
Q.6) Design an application to input marks of five subjects physics, chemistry,
biology, mathematics and computer. Calculate percentage and grade according to
following:
Percentage>=90% : grade A Percentage>=80% : grade B
Percentage>=70% : grade C Percentage>=60% : grade C
Percentage>=40% : grade E Percentage<40% : grade
Program :--
Public Class Form1
Dim Per As Decimal
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim GrandTotal As Integer = 500
Dim Total As Integer
Total = CInt(TextBox1.Text) + CInt(TextBox2.Text) +
CInt(TextBox3.Text) + CInt(TextBox4.Text) + CInt(TextBox5.Text)
Per = (Total / GrandTotal) * 100
Label8.Text = Per & " % "
Select Case Per
Case 90 To 100
Label9.Text = " A "
Case 80 To 89
Label9.Text = " B "
Case 70 To 79
Label9.Text = " C "
Case 60 To 69
15
Label9.Text = " D "
Case 40 To 59
Label9.Text = " E "
Case 0 To 39
Label9.Text = " F "
End Select
End Sub
Output:-
16
Q.7) Design an application to input basic salary of an employee and Gross salary
according to following:
Basic Salary <=10000 :HRA=20%,DA=80%
Basic Salary <=20000 :HRA=25%,DA=90%
Basic Salary >10000 :HRA=30%,DA=95%
Program :-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Dim Basic As Integer = CInt(TextBox1.Text)
Dim HRA As Integer
Dim DA As Integer
Select Case Basic
Case 0 To 10000
TextBox2.Text = CStr(0.2 * Basic)
TextBox3.Text = CStr(0.8 * Basic)
Case 10001 To 20000
TextBox2.Text = CStr(0.25 * Basic)
TextBox3.Text = CStr(0.9 * Basic)
Case 20001 To Integer.MaxValue
TextBox2.Text = CStr(0.3 * Basic)
TextBox3.Text = CStr(0.95 * Basic)
End Select
HRA = CInt(TextBox2.Text)
DA = CInt(TextBox3.Text)
TextBox4.Text = CStr(Basic + HRA + DA)
End Sub
17
Private Sub Button2_Click(sender As Object, e As EventArgs)
Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
End Class
Output:-
18
Q.8) Design an application which is similar to Login Form.
Program:-
19
OUTPUT:-
20
Q.9) WAP using checkbox for the following font effects.
Bold
Italic
Underline
Increase font size
Decrease font size
Font color
Program:-
Public Class Form1
21
End Sub
22
If CheckBox6.Checked = True Then
TextBox1.ForeColor = Color.Blue
End If
If CheckBox6.Checked = False Then
TextBox1.ForeColor = Color.Black
End If
End Sub
23
Output:-
24
Q.10) Design the form that calculate Addition, Multiplication,
division and Subtraction of two number.
Program :-
OUTPUT:-
25
26
Q.11) Design Simple Calculator.
Program :-
Public Class Form1
Dim val1, val2 As Integer
Dim sign As String
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
TextBox1.Text = TextBox1.Text & 1
End Sub
27
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles
Button7.Click
TextBox1.Text = TextBox1.Text & 5
End Sub
28
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles
Button13.Click
val1 = TextBox1.Text
TextBox1.Clear()
TextBox1.Focus()
sign = "/"
End Sub
29
Output:-
30
Q.12) Design the form to input radius of a circle and find its circumference
and area.
Program :-
Public Class Form1
31
Output:-
32
Q.13) Design the form to input length in Centimeter and Convert it into meter.
Program :-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Dim Cm As Integer
Cm = CInt(TextBox1.Text)
TextBox2.Text = Cm / 100
End Sub
33
Output:-
34
Q.14) Design the form to input temperature in Celsius and convert it into
Fahrenheit.
Program :-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Dim cel As Decimal
Dim Fran As Decimal
cel = CInt(TextBox1.Text)
Fran = (cel * (9 / 5)) + 32
TextBox2.Text = Fran
End Sub
35
Output:-
36
Q.15) Design the form to input Principal amount, time, Rate and Calculate
Simple interest and compound interest show result information in
msgbox.
Program :-
Public Class Form1
Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles
Panel1.Paint
End Sub
37
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
End Class
Output:-
38
Q.16) Design the form and write a program to sort array element in
ascending order.
Program :-
Public Class Form1
Dim arr() As Integer = {2, 4, 1, 3, 5}
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
ListBox1.Items.Clear()
Dim i As Integer = 0
For i = 0 To arr.Count - 1
ListBox1.Items.Add(arr(i))
Next
End Sub
39
End If
Next
Next
ListBox1.Items.Clear()
For i = 0 To arr.Count - 1
ListBox1.Items.Add(arr(i))
Next
End Sub
End Class
Output:-
40
Q.17) Design the form and write a program to insert an element in an
Array.
Program :-
Public Class Form1
Dim arr(5) As Integer
Dim i As Integer = 0
Private Sub Button1_Click(sender As Object, e As
EventArgs) Handles Button1.Click
If i < arr.Count - 1 Then
arr(i) = CInt(TextBox1.Text)
ListBox1.Items.Add(arr(i))
i += 1
Else
MsgBox("Array is Full Can't Add More
Element!!")
End If
End Sub
End Class
41
Output:-
42
Q.18) Design the form and write a program to delete an element from an
array at specified position.
Program :-
Public Class Form1
Dim arr() As Integer = {1, 2, 3, 4, 5}
Private Sub Button1_Click(sender As Object, e As
EventArgs) Handles Button1.Click
Dim ArrEnd As Integer = arr.Length - 1
Dim i As Integer = 0
Dim Pos As Integer = CInt(TextBox1.Text)
While i <> Pos
i += 1
End While
While i <> arr.Count - 1
arr(i) = arr(i + 1)
i += 1
End While
ListBox1.Items.Clear()
ReDim Preserve arr(arr.Length - 2)
Dim j As Integer = 0
For j = 0 To arr.Length - 1
ListBox1.Items.Add(arr(j))
Next
End Sub
43
Private Sub Form1_Load(sender As Object, e As
EventArgs) Handles MyBase.Load
Dim i As Integer = 0
ListBox1.Items.Clear()
For i = 0 To arr.Length - 1
ListBox1.Items.Add(arr(i))
Next
End Sub
End Class
Output:-
44
Q.19) Design the from and write a program to print all unique element in
the array.
Program :-
Public Class Form1
Dim arr() As Integer = {9, 9, 8, 1, 3, 6, 9, 7, 1, 2}
45
ListBox2.Items.Add(arr(i))
End If
Next
End Sub
End Class
Output:-
46
Q.20) Design a form to check whether a number is prime Or not using
input box and msgbox.
Program :-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Dim i As Integer
Dim num As Integer = CInt(TextBox1.Text)
Dim f As Boolean = False
For i = 2 To num - 1
If num Mod i = 0 Then
TextBox2.Text = "Not a Prime"
f = True
Exit For
End If
Next
If f = False Then
TextBox2.Text = "Prime Number"
End If
End Sub
End Class
47
Output:-
48
Q.21) Write a program to print Fibonacci series up to n terms.
Program :-
Public Class Form1
Private Sub Button2_Click(sender As Object, e As EventArgs)
Handles Button2.Click
TextBox1.Text = ""
ListBox1.Items.Clear()
End Sub
Public Function GetFib(ByVal n As Integer) As Integer
ListBox1.Items.Clear()
Dim a, b, c As Integer
Dim i As Integer
a = 0
b = 1
ListBox1.Items.Add(a)
ListBox1.Items.Add(b)
For i = 1 To n - 2
ListBox1.Items.Add(a + b)
c = a + b
a = b
b = c
n -= 1
Next
49
Return 0
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Dim n As Integer = CInt(TextBox1.Text)
GetFib(n)
End Sub
End Class
Output:-
50
Q.22) Design the following form when user clicks on Radio Button then select
Checkbox.
Program :-
51
If gen = True And RadioButton4.Checked = True Then
CheckBox1.Checked = False
CheckBox3.Checked = False
CheckBox2.Checked = True
End If
End Sub
End Class
Output:-
52
Q.23) Design the Digital watch using Timer Control.
Program :-
Public Class Form1
53
End If
If mm = 60 Then
mm = 0
hh = hh + 1
End If
If hh = 24 Then
hh = 1
End If
Label1.Text = Format(hh, "00")
Label3.Text = Format(mm, "00")
Label5.Text = Format(ss, "00")
End Sub
Output:-
54
Q.24) Design the following form using horizontal scrollbar. In this, when
user click on particular scrollbar then back color of shape will be changed
to Red, Green & Blue color
Program:-
55
OUTPUT:-
56
Q.25) Design the following form using vertical scrollbar. In
this, when user click on particular scrollbar then back color of
shape will be changed to Red, Green &Blue color.
Program:-
57
OUTPUT:-
58
Q.26) Design the form with different controls.
Program :-
Public Class Form1
Dim msg As String
Dim accessories As String
Dim process As String
Dim Os As String
Private Sub Form1_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
End Sub
59
accessories = accessories + CheckBox2.Text & ","
ElseIf CheckBox2.Checked = False Then
accessories = accessories.Replace("Modem,", "")
End If
End Sub
60
Else
process = ""
End If
End Sub
61
Private Sub Button3_Click(sender As Object, e As EventArgs)
Handles Button3.Click
End
End Sub
62
Output:-
63
Q.27) Write a program for exception handling of throwing an exception
when dividing by zero condition occur during arithmetic operation.
Program :-
Imports System
Module Program
Public Sub Divide(ByVal a As Integer, ByVal b As Integer)
Dim result As Decimal
Try
result = a / b
Catch ex As Exception
Console.WriteLine(" This IS Exception ---->>)
{0}", ex)
Console.ReadLine()
Finally
Console.WriteLine("Result : {0}", result)
Console.ReadLine()
End Try
End Sub
Output:-
64
Q.28) WAP in vb.net such that throw a user define exception when
Temperature is
Zero
Program:-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Dim num As Integer = CInt(Label2.Text)
num += 1
Label2.Text = num
If num = 0 Then
MsgBox("Tempreture is 0 :-)", 48)
End If
End Sub
65
Output:-
66
Q.29) Design form that show the functionality of listbox
Program :-
Public Class Form1
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles
Button5.Click
Dim item As String
item = InputBox("Enter Value : ")
ListBox1.Items.Add(item)
End Sub
67
Else
ListBox2.Items.Add(ListBox1.SelectedItem)
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End Sub
Output:-
Add Value
68
Move >
All move
Remove value
69
Sort
70
Q.30) Write a vb.net program to show data in data Grid view.
Program:-
71
OUTPUT:-
72
Q.31) Create following table Student(id,name,course,DOB,address)
Write vb.net application to
1. Add records
2. View all the records
Program:-
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim n As Integer
Sub Pross()
Dim con As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=D:\DotNet\Q_31_Student.accdb")
con.Open()
Dim adp As New OleDbDataAdapter("select * from Student", con)
Dim ds As New DataSet
adp.Fill(ds, "Student")
n = ds.Tables("Student").Rows.Count
con.Close()
End Sub
73
Sub ShowGrid()
Dim con As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\Anujay Sahay\AppData\Local\Temporary
Projects\WindowsApplication1\Student.accdb")
con.Open()
Dim adp As New OleDbDataAdapter("select * from Student_Table", con)
Dim ds As New DataSet
adp.Fill(ds, "Student_Table")
DataGridView1.DataSource = ds.Tables("Student_Table")
con.Close()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
'TODO: This line of code loads data into the
'StudentDataSet.Student_Table' table. You can move, or remove it, as
needed.
Me.Student_TableTableAdapter.Fill(Me.StudentDataSet.Student_Table)
End Sub
74
con.Close()
MsgBox("Record Saved Succesfully!!!")
End If
End Sub
End Class
OUTPUT :-
75
Q.32) Develop a project which display the student information in the
relevant fields from the database which already exists.
Program :-
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim con As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\jatin\Documents\Q32_Database.accdb")
Dim Index As Integer = 0
Dim table As New DataTable()
76
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Index = 0
ShowData(Index)
End Sub
77
con.Close()
End Sub
End Class
Output:--
78
33. Define structure student. Structure student has data members for
storing name, rollno , name of three subjects and marks. Write member
function to store and print data.
Program :-
Imports System
Module Module1
Structure Student
Dim name As String
Dim roll As Integer
Dim NameOfSub() As String
Dim Marks() As Integer
Sub GetData()
Console.WriteLine("Enter Student Name : ")
name = Console.ReadLine()
Console.WriteLine("Enter Roll Num : ")
roll = Console.ReadLine()
ReDim Preserve NameOfSub(2)
ReDim Preserve Marks(2)
Dim i As Integer
For i = 0 To NameOfSub.Length - 1
Console.WriteLine("Enter Subject " & i + 1 & " : ")
Dim subName As String = CStr(Console.ReadLine())
NameOfSub(i) = subName
Next
For i = 0 To Marks.Length - 1
Console.WriteLine("Enter Marks of Sub " & i + 1 & " : ")
Marks(i) = Console.ReadLine()
Next
End Sub
Sub Print()
Console.WriteLine("Student Name : " & name)
Console.ReadLine()
Console.WriteLine("Student Roll : " & roll)
Console.ReadLine()
Dim i As Integer
For i = 0 To NameOfSub.Length - 1
Console.WriteLine("Subjects : " & NameOfSub(i) & " ")
Console.ReadLine()
Next
For i = 0 To Marks.Length - 1
Console.WriteLine("Marks Of " & NameOfSub(i) & " : " &
Marks(i) & " ")
79
Console.ReadLine()
Next
End Sub
End Structure
Sub Main()
Dim st As New Student
st.GetData()
st.Print()
End Sub
End Module
OUTPUT:-
80
Q.34) Write a class having name Calculate that uses static overloaded
function
to calculate area of circle, area of rectangle and area of triangle.
Program :-
End Class
81
Dim b As Decimal, r As Decimal, i As Decimal, h As Decimal
Dim val As Decimal = 0.5
Dim ch As Integer
End Class
82
Output:-
83
84
Q.35) WAP to check whether a given number is neon or not using user
define function.
Program :-
Public Class Form1
End Function
85
End Sub
End Class
Output:-
86
Q.36) WAP to check whether a given number is Niven or not using procedure.
Program :-
Public Class Form1
NewNumber = CInt(NewNumber)
Num = CInt(Num)
If Num Mod NewNumber = 0 Then
TextBox2.Text = True
Else
TextBox2.Text = False
End If
End Sub
87
CheckNiven(Num)
End Sub
End Class
Output:--
88
37. WAP to check whether a given number is Duck number or not .
Program :-
Public Class Form1
Private Sub Label2_Click(sender As Object, e As EventArgs)
Handles Label2.Click
End Sub
If Num.StartsWith("0") Then
TextBox2.Text = False
ElseIf Num.Contains("0") Then
TextBox2.Text = True
Else
TextBox2.Text = False
End If
End Sub
End Class
89
Output:-
90
Q.38) WAP to check whether a given number is Spy number or not .
Program :-
Public Class Form1
Private Sub Button1_Click_1(sender As Object, e As
EventArgs) Handles Button1.Click
Dim Num As Integer
Num = TextBox1.Text
Dim Sum As Integer = 0
Dim Mul As Integer = 1
Dim Remain As Integer
Dim DummyNum As Integer = Num
End Sub
End Class
91
Output:-
92
Q.39) Write a program to find first and last digit of any number.
Program :-
Public Class Form1
Private Sub Button1_Click_1(sender As Object, e As
EventArgs) Handles Button1.Click
Dim Num As Integer
Console.WriteLine("Enter The Value of Num")
Num = Console.ReadLine()
Dim NewNum As Integer = Num
Dim First As Integer
Dim Last As Integer
Last = NewNum Mod 10
NewNum = NewNum \ 10
Dim remain As Integer
While (NewNum <> 0)
remain = NewNum Mod 10
NewNum = NewNum \ 10
End While
First = remain
Console.WriteLine("First Digit of Num : " & First & " Last Digit of
Num : " & Last)
End Sub
End Class
Output:-
93
Q.40) Write a program to enter any number and print its reverse.
Program :-
Public Class Form1
Private Sub Button1_Click_1(sender As Object, e As
EventArgs) Handles Button1.Click
Dim Num As Integer
Num = TextBox1.Text
Dim Remain As Integer
Dim Reverse As Integer = 0
Dim DummyNum As Integer = Num
While (DummyNum <> 0)
Remain = DummyNum Mod 10
Reverse = Reverse * 10 + Remain
DummyNum = DummyNum \ 10
End While
MsgBox("Num is " & Num & " And Its Reverse is " &
Reverse)
End Sub
End Class
Output:-
94
Q.41) WAP to check whether a given number is Armstrong number or not.
Program :-
End Sub
End Class
95
Output:-
96
Q.42) WAP to enter any number and check whether the no. is palindrome
or not.
Program :-
Public Class Form1
Private Sub Button1_Click_1(sender As Object, e As
EventArgs) Handles Button1.Click
Dim Num As Integer
Num = TextBox1.Text
Dim DummyNum As Integer = Num
Dim Rev As Integer = 0
Dim Remain As Integer
97
Output:-
98
Q.43) Write a Program to calculate factorial of a number using user define
procedure.
Program:-
Public Class Form1
Private Sub Button1_Click_1(sender As Object, e As
EventArgs) Handles Button1.Click
Dim i, n, F As Integer
F = 1
n = TextBox1.Text
For i = 1 To n
F = F * i
Next
MsgBox("Factorial of " & n & " is " & F)
End Sub
End Class
OUTPUT:-
99
Q.44) Create a class circle with data member radius; provide
member function to calculate area. Define a class sphere from class
circle, provide member function to calculate area class cylinder from
class sphere with additional data member for height and member
function to calculate volume.
PROGRAM :-
Imports System
Imports System.Runtime.CompilerServices
Module Program
Class circle
Public radius
As Integer Sub
area(ByVal r As
Integer)
radius = r
Console.WriteLine("Circle class")
Console.Write("Area of Circle :- ")
Console.WriteLine(Math.PI * radius * radius)
End Sub
End Class
Class sphere
Inherits circle
Sub display()
Console.WriteLine("sphere class")
Console.Write("Area of Sphere :- ")
Console.WriteLine(Math.PI * radius * radius *
4)
End Sub
End Class
100
Class cylinder
Inherits sphere
Sub display2(ByVal h1 As Integer)
Dim h As Integer = h1
Console.WriteLine("Cylinder Class")
Console.Write("Volume of Cylinder :- ")
Console.WriteLine(Math.PI * radius * h)
End Sub
End Class
Sub main()
Dim obj As cylinder
= New cylinder()
obj.area(5)
obj.display()
obj.display2(6)
Console.ReadLine()
End Sub
End Module
Output:--
101