Sunday, June 19, 2016

Attendance Management System Program Using Array in Vb.net

Module Module1

    Sub Main()
        Dim studname() As String = {"Rakesh", "Mukesh", "Suresh", "Anil", "Vijay", "Prince"}
        Dim rollno() As Integer = {1001, 1002, 1003, 1004, 1005, 1006}
        Dim attendance(6) As Integer
        Dim counter As Integer = 0
        Dim attenstatus As String
        Dim attencounter As Integer = 0
        Dim totalstudent As Integer = 1
        Dim totabs, totpre As Integer
        totabs = 0
        totpre = 0
        While (totalstudent <= 6)
            Console.Write("Enter Studnet Roll No:-")
            Dim studroll As Integer = Integer.Parse(Console.ReadLine())
            Console.Write(counter)
            For Each studrollno As Integer In rollno
                If studrollno = studroll Then
                    Console.Write("Studnet Name:-" & studname(counter) & vbNewLine)
                    Console.Write("Enter P for Present and A for Absent:-")
                    attenstatus = Console.ReadLine()
                    If (attenstatus = "P") Then
                        attendance(attencounter) = 1
                        attencounter = attencounter + 1
                    ElseIf (attenstatus = "A")
                        attendance(attencounter) = 0
                        attencounter = attencounter + 1
                    End If
                End If
                counter = counter + 1
            Next
            counter = 0
            totalstudent = totalstudent + 1
        End While

        Console.Write("Student Name" & vbTab & "Attendance" & vbNewLine)
        For attendcounter As Integer = 0 To 5
            If attendance(attendcounter) = 0 Then
                totabs = totabs + 1
            ElseIf attendance(attendcounter) = 1
                totpre = totpre + 1
            End If
            Console.Write(studname(attendcounter) & vbTab & vbTab & attendance(attendcounter) & vbNewLine)
        Next
        Console.Write("Total Present Student=" & totpre & vbNewLine & "Total Absent Student=" & totabs)
    End Sub

End Module

0 comments:

Post a Comment