0% found this document useful (0 votes)
9 views

DOT NET AD

Uploaded by

ayushdhankar09
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

DOT NET AD

Uploaded by

ayushdhankar09
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 51

DOT NET TECHNOLOGY

2023-24

ASSIGNMENT NO- 01
1. Write a program to find maximum between three numbers.
Source code:-

Module Module1
Sub Main()
Dim result As Integer = 0
Dim num1 As Integer = 0
Dim num2 As Integer = 0
Dim num3 As Integer = 0
Console.WriteLine("ENTER NUMBER1=")
num1 = Integer.Parse(Console.ReadLine())
Console.WriteLine("ENTER NUMBER2=")
num2 = Integer.Parse(Console.ReadLine())
Console.WriteLine("ENTER NUMBER3=")
num3 = Integer.Parse(Console.ReadLine())
result = If((num1 > num2 AndAlso num1 > num3), num1, If((num2 >
num1 AndAlso num2 > num3), num2, num3))
Console.WriteLine("LARGEST NUMBER IS ={0}", result)
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 1


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 02
2. Write a program to check whether a number is negative, positive or zero
Source code:-

Module Module1
Sub Main()
Dim num As Integer = 0
Console.WriteLine("ENTER NUMBER=")
num = Integer.Parse(Console.ReadLine())
If (num > 0) Then
Console.WriteLine("{0} IS POSITIVE NUMBER", num)
ElseIf (num < 0) Then
Console.WriteLine("{0} IS NEGATIVE NUMBER", num)
ElseIf (num = 0) Then
Console.WriteLine("ZERO NUMBER", num)
End If
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 2


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 03
3. Write a program to check whether a year is leap year or not.
Source code:-

Module Module1
Sub Main()
Dim year As Integer = 0
Dim result As String
Console.WriteLine("ENTER ANY YEAR=")
year = Integer.Parse(Console.ReadLine())
result = If((year Mod 4 = 0), "ENTERED YEAR IS LEAP YEAR", "ENTERED
YEAR IS NOT LEAP YEAR")
Console.WriteLine(result)
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 3


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 04
4. Write a program to check whether a character is alphabet or not.
Source code:-

Module Module1
Sub Main()
Dim ch As Char
Console.WriteLine("ENTER ANY CHARACTER=")
ch = Console.ReadLine()
If ((Asc(ch) >= 65 And Asc(ch) <= 90) Or (Asc(ch) >= 97 And Asc(ch) <=
122)) Then
Console.WriteLine(ch + " IS ALPHABET")
Else
Console.WriteLine(ch + " IS NOT ALPHABET")
End If
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 4


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 05
5. Write a program to search an element for one dimensional array.
Source code:-
Module Module1
Sub Main()
Dim i, ele As Integer
Dim a(5) As Integer
Console.WriteLine("ENTER ARRAY ELEMENTS")
For i = 0 To 4
a(i) = Console.ReadLine()
Next
Console.WriteLine("ENTER SEARCH ELEMENT")
ele = Console.ReadLine()
For i = 0 To 4
If a(i) = ele Then
Console.WriteLine("ELEMENT FOUND AT LOCATION =a[{0}]", i)
Console.ReadKey()
Return
End If
Next
Console.WriteLine("ELEMENT NOT FOUND")
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 5


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 06
6. Design an application to input marks of five subjects Physics, Chemistry,
Biology, Mathematics and Computer. Calculate percentage and grade
Percentage > 90% : Grade A
Percentage >= 80% :Grade B
Percentage > 70% : Grade C
Percentage >60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40%: Grade F
Source code:-

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim p, c, b, m, co As Integer
Dim per As Double
Dim t As Integer
p = Val(TextBox1.Text)
c = Val(TextBox2.Text)
b = Val(TextBox3.Text)

NEHA BCA-III Page 6


DOT NET TECHNOLOGY
2023-24

m = Val(TextBox4.Text)
co = Val(TextBox5.Text)
t = p + c + b + m + co
TextBox6.Text = t
per = t / 5
TextBox7.Text = per
If per > 90 Then
TextBox8.Text = "A"
ElseIf per >= 80 Then
TextBox8.Text = "B"
ElseIf per >= 70 Then
TextBox8.Text = "C"
ElseIf per >= 60 Then
TextBox8.Text = "D"
ElseIf per >= 40 Then
TextBox8.Text = "E"
ElseIf per < 40 Then
TextBox8.Text = "F"
End If
End Sub
End Class

Output:-

NEHA BCA-III Page 7


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 07

NEHA BCA-III Page 8


DOT NET TECHNOLOGY
2023-24

7. Design an application to input basic salary of an employee and calculate its


Gross salary following: Basic Salary <= 10000: HRA = 20%, DA = B0%
Basic Salary 20000 : HRA = 30%, DA = 95%
Source code:-

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim bs, hra, da, gs As Double
bs = Val(TextBox1.Text)
If bs <= 10000 Then
hra = bs * 0.2
da = bs * 0.8
TextBox2.Text = hra
TextBox3.Text = da
ElseIf bs <= 20000 Then
hra = bs * 0.25
da = bs * 0.9
TextBox2.Text = hra
TextBox3.Text = da
ElseIf bs > 20000 Then
hra = bs * 0.3
da = bs * 0.95
TextBox2.Text = hra
TextBox3.Text = da
End If
gs = bs + hra + da
TextBox4.Text = gs
End Sub
End Class

Output:-

NEHA BCA-III Page 9


DOT NET TECHNOLOGY
2023-24

NEHA BCA-III Page 10


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 08
8. Design the following application using radio button and checkbox:
Source code:-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim gen As String
If RadioButton1.Checked = True Then
gen = "MALE"
MsgBox("YOUR GENDER IS:" & gen)
ElseIf RadioButton2.Checked = True Then
gen = "FEMALE"
MsgBox("YOUR GENDER IS:" & gen)
Else
gen = "TRANSGENDER"
MsgBox("YOUR GENDER IS:" & gen)
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Dim fruit As String
If CheckBox1.Checked = True Then
fruit = "APPLE"
End If
If CheckBox2.Checked = True Then
fruit = fruit & " " & "MANGO"
End If
If CheckBox3.Checked = True Then
fruit = fruit & " " & "BANANA"
End If
If CheckBox4.Checked = True Then
fruit = fruit & " " & "ORANGE"
End If
If fruit.Length Then
MsgBox("SELECTED ITEMS:-" & fruit)
End If
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click

NEHA BCA-III Page 11


DOT NET TECHNOLOGY
2023-24

End
End Sub
End Class

Output:-

NEHA BCA-III Page 12


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 09
9. Write a program to convert decimal to binary number system using bitwise
operator.
Source code:-

Module Module1
Sub Main()
Dim iloop As SByte
Dim num As SByte
Console.WriteLine("ENTER ANY NUMBER=")
num = Byte.Parse(Console.ReadLine())
For iloop = 7 To 0 Step -1
If ((1 << iloop) And num) Then
Console.Write("1")
Else
Console.Write("0")
End If
Next
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 13


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 10
10. Write a program to swap two numbers using bitwise operator
Source code:-

Module Module1
Sub Main()
Dim num1 As Integer = 25
Dim num2 As Integer = 35
Console.WriteLine("NUMBER BEFORE SWAPPING=")
Console.WriteLine("NUM1:{0}", num1)
Console.WriteLine("NUM2:{0}", num2)
num1 = num1 Xor num2
num2 = num1 Xor num2
num1 = num1 Xor num2
Console.WriteLine("NUMBER AFTER SWAPPING=")
Console.WriteLine("NUM1:{0}", num1)
Console.WriteLine("NUM2:{0}", num2)
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 14


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 11
11. Write a program to create Simple Calculator using select case.
Source code:-
Module Module1
Sub Main()
Dim choice As Integer
Dim num1 As Integer
Dim num2 As Integer
Dim result As Integer
Console.WriteLine("1. ADDITION")
Console.WriteLine("2. SUBSTRACTION")
Console.WriteLine("3. MULTIPLICATION")
Console.WriteLine("4. DIVISION")
Console.WriteLine("ENTER CHOICE")
choice = Integer.Parse(Console.ReadLine())
Console.WriteLine("ENTER NUMBER 1:-")
num1 = Integer.Parse(Console.ReadLine())

NEHA BCA-III Page 15


DOT NET TECHNOLOGY
2023-24

Console.WriteLine("ENTER NUMBER 2:-")


num2 = Integer.Parse(Console.ReadLine())
Select Case choice
Case 1
result = num1 + num2
Case 2
result = num1 - num2
Case 3
result = num1 * num2
Case 4
result = num1 / num2
Case Else
Console.WriteLine("INVALID CHOICE")
End Select
Console.WriteLine("RESULT:-{0}", result)
Console.ReadKey()
End Sub
End Module

Output:-

1.Addition 2.Subtraction 3.Multiplication 4.Division

ASSIGNMENT NO- 12
12. Write a program to find sum of all natural numbers between 1 ton
Source code:-

Module Module1
Sub Main()
Dim n As Integer
Dim sum As Integer = 0

NEHA BCA-III Page 16


DOT NET TECHNOLOGY
2023-24

Console.Write("Enter Number: ")


n = Byte.Parse(Console.ReadLine()) '

For i As Integer = 1 To n
sum += i
Next

Console.WriteLine("The sum of all natural numbers between 1 and “ & n & " is: " & sum)
Console.ReadKey()
End Sub
End Module

Output:-

ASSIGNMENT NO- 13
13. Write a program to find first and last digit of any number
Source code:-

Module Module1
Sub Main()
Dim D1, D2, N As Integer

NEHA BCA-III Page 17


DOT NET TECHNOLOGY
2023-24

Console.WriteLine("ENTER ANY NUMBER")


N = Integer.Parse(Console.ReadLine())
D2 = N Mod 10
D1 = N
While (D1 >= 10)
D1 = D1 \ 10
End While
Console.WriteLine("FIRST DIGIT IS=:" & D1)
Console.WriteLine("LAST DIGIT IS=:" & D2)
Console.ReadKey()
End Sub
End Module

Output:-

ASSIGNMENT NO- 14
14. Write a program to enter any number and print its reverse.
Source code:-

NEHA BCA-III Page 18


DOT NET TECHNOLOGY
2023-24

Module Module1

Sub Main()
Dim number As Integer = 0
Dim remainder As Integer = 0
Dim reverse As Integer = 0
Console.Write("Enter the number:")
number = Integer.Parse(Console.ReadLine())
While (number > 0)
remainder = number Mod 10
reverse = reverse * 10 + remainder
number = number / 10
End While
Console.WriteLine("Reverse:{0}", reverse)
Console.ReadLine()

End Sub
End Module

Output:-

ASSIGNMENT NO- 15

NEHA BCA-III Page 19


DOT NET TECHNOLOGY
2023-24

15. Write a program to enter any number and check whether the number is
palindrome or not
Source code:-

Module Module1
Sub Main()
Dim number As Integer = 0
Dim remainder As Integer = 0
Dim reverse As Integer = 0
Dim temp As Integer = 0
Console.WriteLine("ENTER ANY NUMBER")
number = Integer.Parse(Console.ReadLine())
temp = number
While (number > 0)
remainder = number Mod 10
reverse = reverse * 10 + remainder
number = number / 10
End While
If temp = reverse Then
Console.WriteLine("PALINDROME")
Else
Console.WriteLine("NOT PALINDROME")
End If
Console.ReadKey()

End Sub
End Module

Output:-

NEHA BCA-III Page 20


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 16
16. Write a program to check whether a number is Armstrong number or
not
Source code:-

Module Module1
Sub Main()
Dim number As Integer = 0
Dim remainder As Integer = 0
Dim result As Integer = 0
Dim temp As Integer = 0
Console.WriteLine("ENTER ANY NUMBER")
number = Integer.Parse(Console.ReadLine())
temp = number
While (temp > 0)
remainder = temp Mod 10
result = result + (remainder * remainder * remainder)
temp = temp \ 10
End While
If number = result Then
Console.WriteLine("NUMBER IS ARMSTRONG")
Else
Console.WriteLine("NUMBER IS NOT ARMSTRONG")
End If
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 21


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 17
17. Write a program to print Fibonacci series up to n terms.
Source code:-

Module Module1
Sub Main()
Dim a, b, c, n, i As Integer
Console.Write("ENTER HOW MANY ELEMENTS:=")
n = Val(Console.ReadLine())
a=0
b=1
Console.WriteLine("0")
Console.WriteLine("1")
i=1
While (i < n - 1)
c=a+b
Console.WriteLine(c & "")
a=b
b=c
i=i+1
End While
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 22


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 18
18. Write a program to print Pascal triangle up to n rows
Source code:-

Module Module1
Sub Main()
Dim i, j, k, l, n As Integer
Console.WriteLine("ENTER NUMBER OF ROWS")
n = Console.ReadLine()
For i = 1 To n
For j = 1 To n - i
Console.Write(" ")
Next
For k = 1 To i
Console.Write("{0}", k)
Next
For l = i - 1 To 1 Step -1
Console.Write("{0}", l)
Next
Console.WriteLine(" ")
Next
Console.ReadKey()
End Sub

NEHA BCA-III Page 23


DOT NET TECHNOLOGY
2023-24

End Module

Output:-

ASSIGNMENT NO- 19
19. Write a program to print all negative elements in an array.
Source code:-

Module Module1
Sub Main()
Dim i As Integer
Dim a(5) As Integer
Console.WriteLine("ENTER ARRAY ELEMENTS")
For i = 0 To 4
a(i) = Console.ReadLine()
Next
Console.WriteLine("NEGATIVE ELEMENTS ARE:-")
For i = 0 To 4
If (a(i) < 0) Then
Console.WriteLine("{0}", a(i))
End If
Next
Console.ReadKey()

NEHA BCA-III Page 24


DOT NET TECHNOLOGY
2023-24

Console.ReadLine()
End Sub
End Module

Output:-

ASSIGNMENT NO- 20
20. Design a digital clock using timer control.
Source code:-

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Label2.Text = TimeString
Label3.Text = DateString
End Sub
End Class

Output:-

NEHA BCA-III Page 25


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 21
21. Design an application that accepts the item name from the user and
add it to a list box and combo box.
Source code:-

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text)
ComboBox1.Items.Add(TextBox1.Text)
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

NEHA BCA-III Page 26


DOT NET TECHNOLOGY
2023-24

TextBox1.Text = ""
End Sub
End Class

Output:-

ASSIGNMENT NO- 22
22. Create an application that offers various food items to select from
check boxes and a mode of payment using radio button. It then display the
total amount payable.
Source code:-
Public Class Form1
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Text = 25
End If

NEHA BCA-III Page 27


DOT NET TECHNOLOGY
2023-24

If CheckBox2.Checked = True Then


TextBox2.Text = 35
End If
If CheckBox3.Checked = True Then
TextBox3.Text = 45
End If
If CheckBox4.Checked = True Then
TextBox4.Text = 55
End If
TextBox5.Text = Val(TextBox1.Text) + Val(TextBox2.Text) +
Val(TextBox3.Text) + Val(TextBox4.Text)
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton2.CheckedChanged
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
End Class
Output:-

ASSIGNMENT NO- 23
23. Write a program using check names for the following font effects
Bold
Italic
Underline
NEHA BCA-III Page 28
DOT NET TECHNOLOGY
2023-24

Increase Font size


Decrease Font size
Font Color
Source code:-
Public Class Form1
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles
CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Font = New Font(Font.FontFamily, TextBox1.Font.Size,
FontStyle.Bold)
End If
End Sub

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


CheckBox2.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Font = New Font(Font.FontFamily, TextBox1.Font.Size,
FontStyle.Italic)
End If
End Sub

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


CheckBox3.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Font = New Font(Font.FontFamily, TextBox1.Font.Size,
FontStyle.Underline)
End If
End Sub

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


CheckBox4.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Font = New Font(Font.FontFamily, TextBox1.Font.Size +
12, FontStyle.Underline)
End If
End Sub

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


CheckBox5.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Font = New Font(Font.FontFamily, TextBox1.Font.Size -
12, FontStyle.Underline)
End If
End Sub

NEHA BCA-III Page 29


DOT NET TECHNOLOGY
2023-24

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


CheckBox6.CheckedChanged
If CheckBox6.Checked = True Then
TextBox1.ForeColor = Color.Blue
End If
End Sub
End Class

Output:-

NEHA BCA-III Page 30


DOT NET TECHNOLOGY
2023-24

NEHA BCA-III Page 31


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 24
24. Write a program to launch a rocket using Picture Box and Timer
control
Source code:-
Public Class Form1
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
PictureBox1.Top = PictureBox1.Top - 1
End Sub

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


Timer1.Start()

End Sub
End Class

Output:-

NEHA BCA-III Page 32


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 25
25. Write a program to change the back color of any control using scroll
box.
Source code:-
Public Class Form1
Private Sub HScrollBar1_Scroll(sender As Object, e As ScrollEventArgs) Handles
HScrollBar1.Scroll
TextBox1.BackColor = Color.Green
End Sub
Private Sub VScrollBar1_Scroll(sender As Object, e As ScrollEventArgs) Handles
VScrollBar1.Scroll
TextBox1.BackColor = Color.Red
End Sub
End Class
Output:-

HScrollBar

VScrollBar

NEHA BCA-III Page 33


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 26
26. Design an application to create the Payroll form shown below. Number
of hours well as the appropriate rate.
Gross salary = rate* hours.
Net salary = gross salary - deductions.
Source code:-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
TextBox4.Text = 10 * Val(TextBox2.Text)
TextBox5.Text = Val(TextBox4.Text) - Val(TextBox3.Text)
End If
If RadioButton2.Checked = True Then
TextBox4.Text = 12.5 * Val(TextBox2.Text)
TextBox5.Text = Val(TextBox4.Text) - Val(TextBox3.Text)
End If
If RadioButton3.Checked = True Then
TextBox4.Text = 15 * Val(TextBox2.Text)
TextBox5.Text = Val(TextBox4.Text) - Val(TextBox3.Text)
End If
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

NEHA BCA-III Page 34


DOT NET TECHNOLOGY
2023-24

End Sub
End Class

Output:-

NEHA BCA-III Page 35


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 27
27. Develop an application for billing system in coffee shop
Source code:-
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("COFFEE")
ComboBox1.Items.Add("TEA")
End Sub

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


ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex = 0 Then
ComboBox2.Text = ""
ComboBox2.Items.Clear()
ComboBox2.Items.Add("COLD COFFEE")
End If
If ComboBox1.SelectedIndex = 1 Then
ComboBox2.Text = ""
ComboBox2.Items.Clear()
ComboBox2.Items.Add("MASALA TEA")
End If
End Sub

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


ComboBox2.SelectedIndexChanged

NEHA BCA-III Page 36


DOT NET TECHNOLOGY
2023-24

If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 0 Then


ComboBox3.Text = ""
ComboBox3.Items.Clear()
ComboBox3.Items.Add("CLASSIC")
End If
If ComboBox1.SelectedIndex = 1 And ComboBox2.SelectedIndex = 0 Then
ComboBox3.Text = ""
ComboBox3.Items.Clear()
ComboBox3.Items.Add("LATTE")
End If
End Sub

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


If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 0 And
ComboBox3.SelectedIndex = 0 Then
TextBox1.Text = 2000
End If
If ComboBox1.SelectedIndex = 1 And ComboBox2.SelectedIndex = 0 And
ComboBox3.SelectedIndex = 0 Then
TextBox1.Text = 4000
End If
End Sub
End Class

Output:-

NEHA BCA-III Page 37


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 28
28. Develop an application which is similar to login form
Source code:-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If (TextBox1.Text = "ADMIN" And TextBox2.Text = "ADMIN") Then
TextBox3.Text = "LOGIN SUCCESSFULLY"
Else
TextBox3.Text = "INVALID USERNAME AND PASSWORD"
End If
End Sub

NEHA BCA-III Page 38


DOT NET TECHNOLOGY
2023-24

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class
Output:-

ASSIGNMENT NO- 29
29. Define a class account include following data members: Name of the
depositor account no, type of Account, balance amount, Member
Functions: To deposit an amount, To withdraw an amount after checking
balance, to show balance also provide proper validation wherever
necessary write a main program to test above class
Source code:-

NEHA BCA-III Page 39


DOT NET TECHNOLOGY
2023-24

Module Module1
Public Class Account
Public name_depositor As String
Public account_no As Integer
Public type_account As String
Public balance_amount As Integer
Public Sub init()
Console.WriteLine("ENTER NAME")
name_depositor = Console.ReadLine()
Console.WriteLine("ENTER ACCOUNT NUMBER")
account_no = Console.ReadLine()
Console.WriteLine("ENTER TYPE ACCOUNT")
type_account = Console.ReadLine()
Console.WriteLine("ENTER BALANCE")
balance_amount = Console.ReadLine()
End Sub
Public Sub Depo_Amount()
Dim depo As Integer
Console.WriteLine("ENTER DEPOSIT AMOUNT")
depo = Console.ReadLine()
balance_amount += depo
End Sub
Public Sub Display()
Console.WriteLine("NAME IS:-" & name_depositor)
Console.WriteLine("ACCOUNT NUMBER IS:-" & account_no)
Console.WriteLine("TYPE OF ACCOUNT:-" & type_account)
Console.WriteLine("BALANCE IS:-" & balance_amount)
End Sub
Public Sub With_Amount()
Dim draw As Integer
Console.WriteLine("ENTER WITHDRAW AMOUNT")
draw = Console.ReadLine()
If (draw <= balance_amount) Then
balance_amount -= draw
End If
End Sub
End Class
Sub Main()
Dim b1 As New Account
b1.init()
b1.Depo_Amount()
b1.With_Amount()
b1.Display()
Console.ReadKey()

NEHA BCA-III Page 40


DOT NET TECHNOLOGY
2023-24

End Sub
End Module

Output:-

NEHA BCA-III Page 41


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 30
30. Create a class student having data member to store roll number name
of the student name of three subject Max marks, Min marks, obtained
marks. Declare an object of class student. Provide facilities to input data in
data members and display result of students.
Source code:-
Module Module1
Class student
Dim i As Integer
Dim name(2) As String
Dim rollno(2) As Integer
Dim min, max, obtain, phy, chemis, maths As Integer
Public Function getdata() As Integer
For i = 0 To 1
Console.WriteLine("ENTER ROLLNO:-")
rollno(i) = Console.ReadLine()
Console.WriteLine("ENTER NAME:-")
name(i) = Console.ReadLine()
Console.WriteLine("ENTER MAXIMUM MARKS:-")
max = Console.ReadLine()
Console.WriteLine("ENTER MINIMUM MARKS:-")
min = Console.ReadLine()
Console.WriteLine("ENTER MARKS FOR PHYSICS:-")
phy = Console.ReadLine()
Console.WriteLine("ENTER MARKS FOR CHEMISTRY:-")
chemis = Console.ReadLine()
Console.WriteLine("ENTER MARKS FOR MATHS:-")
maths = Console.ReadLine()
obtain = phy + chemis + maths
Next
For i = 0 To 1
Console.WriteLine("ROLL NO IS:-" & rollno(i))
Console.WriteLine("NAME IS:-" & name(i))
Console.WriteLine("MAXIMUM MARKS:-" & max)
Console.WriteLine("MINIMUM MARKS:-" & min)
Console.WriteLine("MARKS OBTAIN FOR PHYSICS:-" & phy)
Console.WriteLine("MARKS OBTAIN FOR CHEMISTRY:-" & chemis)
Console.WriteLine("MARKS OBTAIN FOR MATHS:-" & maths)
Console.WriteLine("TOTAL MARKS OBTAIN:-" & obtain)
Next
End Function
End Class
Sub Main()
Dim s As New student

NEHA BCA-III Page 42


DOT NET TECHNOLOGY
2023-24

s.getdata()
Console.ReadKey()
End Sub
End Module

Output:-

NEHA BCA-III Page 43


DOT NET TECHNOLOGY
2023-24

NEHA BCA-III Page 44


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 31
31. Write a program to find greatest among three given number using user
define procedures.
Source code:-
Module Module1
Function MAXIMUM(ByVal valueone As Integer, ByVal valuetwo As Integer, ByVal valuethree As Integer)

Return Math.Max(Math.Max(valueone, valuetwo), valuethree)


End Function
Sub Main()
Dim value1, value2, value3 As Integer
Console.Write("ENTER NUMBER1:-")
value1 = Integer.Parse(Console.ReadLine())
Console.Write("ENTER NUMBER1:-")
value2 = Integer.Parse(Console.ReadLine())
Console.Write("ENTER NUMBER1:-")
value3 = Integer.Parse(Console.ReadLine())
Console.WriteLine(MAXIMUM(value1, value2, value3))
Console.ReadKey()
End Sub
End Module
Output:-

ASSIGNMENT NO- 32

NEHA BCA-III Page 45


DOT NET TECHNOLOGY
2023-24

32. Write a program to calculate factorial of a number using user define


procedure.
Source code:-
Module Module1
Function Fact(ByVal num As Integer)
If (num = 0) Then
Return 0
ElseIf (num = 1) Then
Return 1
Else
Return num * Fact(num - 1)
End If
End Function
Sub Main()
Dim n, f As Integer
Console.WriteLine("ENTER ANY NUMBER:-")
n = Console.ReadLine()
f = Fact(n)
Console.WriteLine("FACTORIAL IS:-{0}", f)
Console.ReadKey()
End Sub
End Module
Output:-

ASSIGNMENT NO- 33

NEHA BCA-III Page 46


DOT NET TECHNOLOGY
2023-24

33. Write a program to check whether a given number is duck number or


not.
Source code:-
Module Module1
Sub Main()
Dim n, r, c, p As Integer
Console.WriteLine("ENTER ANY NUMBER")
n = Console.ReadLine()
c=0
While n > 0
r = n Mod 10
If (r = 0) Then
c=c+1
Else
p=r
End If
n = n \ 10
End While
If (c > 0) Then
Console.WriteLine("ENTERED NUMBER IS DUCK NUMBER")
Else
Console.WriteLine("ENTERED NUMBER IS NOT DUCK NUMBER")
End If
Console.ReadKey()
End Sub
End Module
Output:-

ASSIGNMENT NO- 34

NEHA BCA-III Page 47


DOT NET TECHNOLOGY
2023-24

34. Write a program to check whether a given number is spy number or


not.
Source code:-
Module Module1
Dim num As Integer
Dim sum As Integer = 0
Dim multi As Integer = 1
Dim rm As Integer
Sub Main()
Console.WriteLine("ENTER ANY NUMBER")
num = Console.ReadLine()
sum = 0
While (num <> 0)
rm = num Mod 10
sum = sum + rm
multi = multi * rm
num = num / 10
End While
If (sum = multi) Then
Console.WriteLine("ENTERED NUMBER IS SPY NUMNER")
Else
Console.WriteLine("ENTERED NUMBER IS NOT SPY NUMNER")
End If
Console.ReadKey()
End Sub
End Module
Output:-

ASSIGNMENT NO- 35

NEHA BCA-III Page 48


DOT NET TECHNOLOGY
2023-24

35. Write a program to demonstrate concept of polymorphism function


overloading and constructor overloading.
Source code:-
Module Module1
Class Sample
Public num As Integer
Public Sub New()
Console.WriteLine("DEFAULT OR NO ARGUMENT CONSTRUCTOR CALLED TO
INITIALIZE DATA MEMBERS")
num = 20
End Sub
Public Sub New(ByVal N1 As Integer)
Console.WriteLine("PARAMETERIZED CONSTRUCTOR CALLED TO INITIALIZE DATA MEMBERS")
num = N1
End Sub
Public Sub PRINT()
Console.WriteLine("VALUE OF NUM:{0}", num)
End Sub
End Class
Sub Main()
Dim obj1 As New Sample()
Dim obj2 As New Sample(20)
obj1.PRINT()
obj2.PRINT()
Console.ReadKey()
End Sub

End Module
Output:-

NEHA BCA-III Page 49


DOT NET TECHNOLOGY
2023-24

ASSIGNMENT NO- 36
36. Create a class array having an array of integer having five elements at
data member provide following facilities:
a) constructor to get number in array element
b) sort the elements
c) find the largest element
d) search the present of particular value in an array element.
Source code:-
Module Module1
Class Array
Dim arr(5) As Integer
Public Function getData() As Integer
For i = 0 To 4
Console.WriteLine("ENTER ARRAY ELEMENTS")
arr(i) = Console.ReadLine()
Next
For i = 0 To 4
Console.WriteLine("ELEMENT IS:-" & arr(i))
Next
End Function
Public Function getSort() As Integer
Dim j, temp As Integer
For i = 0 To 4 Step 1
For j = 4 To i + 1 Step -1
If (arr(j) < arr(j - 1)) Then
temp = arr(j)
arr(j) = arr(j - 1)
arr(j - 1) = temp
End If
Next
Next
Console.WriteLine("SORTED ELEMENTS ARE:-")
For i = 0 To 4
Console.WriteLine("{0}", arr(i))
Next
End Function
Public Function getLarge() As Integer
Dim large As Integer
For i = 0 To 4 Step 1
If (large < arr(i)) Then
large = arr(i)
End If
Next
Console.WriteLine("LARGEST ELEMENT IS:-{0}", large)
End Function
Public Function getSearch() As Integer
Dim ele As Integer
Console.WriteLine("ENTER ELEMENT TO BE SEARCH")
ele = Console.ReadLine()
For i = 0 To 4
If arr(i) = ele Then

NEHA BCA-III Page 50


DOT NET TECHNOLOGY
2023-24
Console.WriteLine("ELEMENT FOUND AT LOCATION={0}", i +
1)
Console.WriteLine("ARRAY ELEMENT IS :-" & arr(i))
Console.ReadKey()
Return True
End If
Next
Console.WriteLine("ELEMENT NOT FOUND")
End Function
End Class
Sub Main()
Dim s As Array = New Array()
s.getData()
s.getSort()
s.getLarge()
s.getSearch()
Console.ReadKey()
End Sub
End Module
Output:-

NEHA BCA-III Page 51

You might also like