Microsoft Word DJAP4 BCA

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

LAB MANUAL FOR PRACTICAL COURSES

BCA

DIRECTORATE OF DISTANCE & CONTINUING EDUCATION


MANONMANIAM SUNDARANAR UNIVERSITY
TIRUNELVELI - 627 012

DECEMBER 2020 / MAY 2021


PRACTICAL EXAMINATION

1
DIRECTORATE OF DISTANCE & CONTINUING EDUCATION
MANONMANIAM SUNDARANAR UNIVERSITY
Reaccredited with ‘A’ Grade (CGPA 3.13 out of 4.0) by NAAC (3rd Cycle)
TIRUNELVELI – 627 012, Tamilnadu, India

Department of Computer Science


This is to certify that this is the bonafide record work of practical work done by

Mr./Ms. ________________________ Reg.No._________________________ of II BCA.,

Visual Basic, at the Directorate of Distance & Continuing Education,

Manonmaniam Sundaranar University, Tirunelveli during the academic year

________________.

Internal Examiner External Examiner

2
Visual Basic (DJAP4 – Practical IV )

CONTENTS

Sl. Title of the Exercise Page No.


No.
1. Print the Sentence 04

2. String Concatenation 05

3. Vowel or Not 06

4. String Conversion 07

5. Simple Calculator 08

6. Online Examination 12

3
Excercise Number - 1: Print the sentence

Aim:
To write a program to print the sentence "Write First program in Visual basic"

Algorithm:

1. Start the application


2. To create a module
3. To declare the variable string as dimension
4. Assign any sentence to the variable as str
5. To display the sentence
6. End the Module
7. Deploy and run the program

Source Code:

Module Module1
Sub Main()
Dim str As String
str = "Write First program in Visual basic"
Console.WriteLine(str)
Console.ReadLine()
End Sub
End Module

Output:

Write First Program in Visual basic

Result:

Thus the program was executed and its output was verified.

4
Excercise Number - 2: String Concatenation

Aim:

To write a program to concatenate any two or more strings in Visual basic.

Algorithm:

1. Start the application


2. To create a module and declare the variable string as dimension
3. Assign any word to each of the variables
4. To concatenate all the words and print them
5. End the module
6. Deploy and run the program

Source Code:
Module Module1
Sub Main()
Dim str1, str2, str3 As String
str1 = "Visual"
str2 = "Basic"
str3 = "Program"
Console.WriteLine(str1 + " " + str2 + " " + str3)
Console.ReadLine()
End Sub
End Module
Output:
Visual basic program

Result:

Thus the program was executed and its output was verified.

5
Excercise Number - 3: Vowel or not

Aim:

To write a program to check whether a character is vowel or not.

Algorithm:

1. Start the application and create and design a form with needed buttons
2. Click the button to write the program in editor page
3. To declare the variable as string
4. To create textbox and assign the textbox values as variable
5. If the textbox values as vowel then the message box displays “The Given String is
vowel”
6. Otherwise the messagebox displays “The Given String is not vowel”
7. Deploy and run the program

Source Code:

Public Class Vowels


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim c As String
c = TextBox1.Text
If c = "a" Or c = "A" Or c = "e" Or c = "E" Or c = "i" Or c = "I" Or c = "o" Or c =
"O" Or c = "u" Or c = "U" Then
MsgBox("The Given String is vowel")
Else
MsgBox("The Given String is not vowel")
End If
End Sub
End Class

Output:

Result:

Thus the program was executed and its output was verified.

6
Excercise Number - 4: String Conversion

Aim:

To write a program to accept character for console and check the case of the character.

Algorithm:

1. Start the application


2. Open a new file and design the form with needed such controls as labelbox,
textbox,button.
3. Click the button to write the program in editor page
4. Check the string is lower or upper case
5. Deploy and run the program

Source Code:

Public Class Conversion


Private Sub Low_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Low.Click
TextBox2.Text = TextBox1.Text.ToLower
End Sub
Private Sub Upp_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Upp.Click
TextBox2.Text = TextBox1.Text.ToUpper
End Sub
End Class

Output:

Result:

Thus the program was executed and its output was verified.

7
Excercise Number - 5: Simple Calculator

Aim:

To write a program to develop a simple calculator for an arithmetic operations

Algorithm:
1. Start the application
2. Open a new file and design the form with needed such controls as labelbox,
textbox,button.
3. Click the button to write the program in editor page
4. Click the +,-,*,/ operator to prefer their respective operations
5. Use if else condition to do all the operations of arithmetic calculations
6. Deploy and run the program

Source code:
Public Class Form1
Dim frstnum As Decimal
Dim scndnum As Decimal
Dim operations As Integer
Dim operator_selector As Boolean = False
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "1"
Else
TextBox1.Text = "1"
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "2"
Else
TextBox1.Text = "2"
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "3"
Else
TextBox1.Text = "3"
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click

8
If TextBox1.Text <> "0" Then
TextBox1.Text += "4"
Else
TextBox1.Text = "4"
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "5"
Else
TextBox1.Text = "5"
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "6"
Else
TextBox1.Text = "6"
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button7.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "7"
Else
TextBox1.Text = "7"
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button8.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "8"
Else
TextBox1.Text = "8"
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button9.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "9"
Else
TextBox1.Text = "9"
End If
End Sub

9
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button10.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "0"
End If
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button11.Click
frstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 1 '=+
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button12.Click
frstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 2 '=-
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button13.Click
frstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 3 '=*
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button14.Click
frstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 4 '=/
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button16.Click
If Not (TextBox1.Text.Contains(".")) Then
TextBox1.Text += "."
End If
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button15.Click
TextBox1.Text = "0"
End Sub
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button17.Click

10
If operator_selector = True Then
scndnum = TextBox1.Text
If operations = 1 Then
TextBox1.Text = frstnum + scndnum
ElseIf operations = 2 Then
TextBox1.Text = frstnum - scndnum
ElseIf operations = 3 Then
TextBox1.Text = frstnum * scndnum
ElseIfscndnum = 0 Then
TextBox1.Text = "Error!"
Else
TextBox1.Text = frstnum / scndnum
End If
operator_selector = False
End If
End Sub
End Class

Output:

Result:

Thus the program was executed and its output was verified.

11
Excercise Number - 6: Online Examination

Aim:

To write a program to create Online Examination Using Timer.

Algorithm:

1. Start the application


2. Open a new file and design the form with needed such controls as labelbox,
textbox,button.
3. Click the button to write the editor page
4. Set a Timer as an interval = 1000 seconds
5. To declare all the variables
6. Radio button is used for the answer selection in the online exam
7. Use the message box to display the result
8. Deploy and run the program

Source Code:

Public Class Form1


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Label3.Text = 20
Timer1.Enabled = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label3.Visible = False
Dim total As Integer
total = 0
If RadioButton1.Checked = True Then
total += 1
End If
If RadioButton3.Checked = True Then
total += 1
End If
MsgBox("Your Mark is " & total)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If Label3.Text = 0 Then
Timer1.Enabled = False
MsgBox("Timeout")
Else
Label3.Text = Label3.Text - 1

12
End If
End Sub
End ClassPublic Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Label3.Text = 20
Timer1.Enabled = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label3.Visible = False
Dim total As Integer
total = 0
If RadioButton1.Checked = True Then
total += 1
End If
If RadioButton3.Checked = True Then
total += 1
End If
MsgBox("Your Mark is " & total)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If Label3.Text = 0 Then
Timer1.Enabled = False
MsgBox("Timeout")
Else
Label3.Text = Label3.Text - 1
End If
End Sub
End Class

Output:

Result:

Thus the program was executed and its output was verified.

13

You might also like