DOT NET AD
DOT NET AD
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:-
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:-
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:-
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:-
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:-
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:-
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:-
ASSIGNMENT NO- 07
Output:-
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
End Sub
End
End Sub
End Class
Output:-
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:-
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:-
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())
Output:-
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
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
Output:-
ASSIGNMENT NO- 14
14. Write a program to enter any number and print its reverse.
Source code:-
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
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:-
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:-
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:-
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
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()
Console.ReadLine()
End Sub
End Module
Output:-
ASSIGNMENT NO- 20
20. Design a digital clock using timer control.
Source code:-
Output:-
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:-
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
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
Output:-
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
End Sub
End Class
Output:-
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
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
End Sub
End Class
Output:-
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
Output:-
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
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:-
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()
End Sub
End Module
Output:-
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
s.getdata()
Console.ReadKey()
End Sub
End Module
Output:-
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)
ASSIGNMENT NO- 32
ASSIGNMENT NO- 33
ASSIGNMENT NO- 34
ASSIGNMENT NO- 35
End Module
Output:-
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