Personal Transformation Starts HERE!
Resources to Help You Improve Your Life
Objective: To understand variables, input/output, and conditional statements (If...ElseIf).
Design:
Code:
Public Class Form1 Private Sub btnFind_Click(sender As Object, e As EventArgs) Handles btnFind.Click ' Declare variables Dim num1, num2, num3 As Integer' Parse input from TextBoxes num1 = Integer.Parse(TextBox1.Text) num2 = Integer.Parse(TextBox2.Text) num3 = Integer.Parse(TextBox3.Text) ' Logic to find the largest number If num1 > num2 And num1 > num3 Then Label1.Text = "The Largest Number is: " & num1 ElseIf num2 > num1 And num2 > num3 Then Label1.Text = "The Largest Number is: " & num2 Else Label1.Text = "The Largest Number is: " & num3 End If End Sub
End Class
Before you raise your hand to show the output, run through this checklist:
Aim: Generate a Fibonacci series up to N terms.
Module Module1 Sub Main() Dim n, i As Integer Dim first As Integer = 0, second As Integer = 1, nextTerm As IntegerConsole.Write("Enter the number of terms: ") n = Console.ReadLine() Console.Write("Fibonacci Series: " & first & ", " & second) For i = 3 To n nextTerm = first + second Console.Write(", " & nextTerm) first = second second = nextTerm Next Console.ReadLine() End Sub
End Module
🔧 Common Fixes for Students:
BCA evaluators love asking for Class and Object implementation.
Aim: Create a Student class with roll number, name, and percentage.
Public Class Student Private _rollNo As Integer Private _name As String Private _percentage As Double' Constructor Public Sub New(ByVal roll As Integer, ByVal name As String, ByVal per As Double) _rollNo = roll _name = name _percentage = per End Sub ' Method Public Sub Display() Console.WriteLine("Roll: " & _rollNo) Console.WriteLine("Name: " & _name) Console.WriteLine("Percentage: " & _percentage & "%") End SubEnd Class
' In Main Module: Sub Main() Dim s1 As New Student(101, "Aarav Sharma", 89.4) s1.Display() Console.ReadLine() End Sub
🔧 The "Fix" for Access Modifiers: