Pages

Friday, 30 August 2013

Simple Grading System Using Visual Basic.net Console Application

Download Project

Download Code

Project Specification

Programming Language Use: Visual Basic.Net (Console Application)
IDE : Visual Studio 2010 with version 4.0 .net Framework

Here is the Code:

Imports System.Console
Module Module1


    Dim x As Integer = 5
    Dim pGrade, mGrade, pfGrade, fGrade As Integer
    Dim name, gender, Course, subject, sem_grade, remarks, chc, pass As String
    Dim q1, q2, cs, exam, grade As Integer
    Dim term_grade As Integer
    Dim prelim, midterm, pre_final, final, equi1 As Integer
    Dim equi As Decimal


    Sub Main()
        Clear()
        Title = "Grading System"
        Call student_info()
        Call result()
        Call made()

        'for student_info
        SetCursorPosition(Len("name:") + x + 1, 5)
        name = ReadLine()
        SetCursorPosition(Len("gender:") + x + 1, 6)
        gender = ReadLine()
        SetCursorPosition(Len("course:") + x + 1, 7)
        Course = ReadLine()
        SetCursorPosition(Len("subject:") + x + 1, 8)
        subject = ReadLine()






        'for made=prelim
        SetCursorPosition(Len("Q1:") + x, 14)
        q1 = ReadLine()
        SetCursorPosition(Len("Q2:") + x, 15)
        q2 = ReadLine()
        SetCursorPosition(Len("CS:") + x, 16)
        cs = ReadLine()
        SetCursorPosition(Len("Exam:") + x, 17)
        exam = ReadLine()

        'compute

        pGrade = (((q1 + q2) / 2) * 0.2) + (cs * 0.2) + (exam * 0.6)
        SetCursorPosition(Len("Grade:") + x, 18)
        Write(pGrade.ToString)


        'for made=midterm
        SetCursorPosition(Len("Q1:") + x + 15, 14)
        q1 = ReadLine()
        SetCursorPosition(Len("Q2:") + x + 15, 15)
        q2 = (ReadLine())
        SetCursorPosition(Len("CS:") + x + 15, 16)
        cs = ReadLine()
        SetCursorPosition(Len("Exam:") + x + 15, 17)
        exam = ReadLine()

        mGrade = (((q1 + q2) / 2) * 0.2) + (cs * 0.2) + (exam * 0.6)
        SetCursorPosition(Len("Grade:") + x + 15, 18)
        Write(mGrade.ToString)


        'for made=prefinal
        SetCursorPosition(Len("Q1:") + x + 30, 14)
        q1 = ReadLine()
        SetCursorPosition(Len("Q2:") + x + 30, 15)
        q2 = ReadLine()
        SetCursorPosition(Len("CS:") + x + 30, 16)
        cs = ReadLine()
        SetCursorPosition(Len("Exam:") + x + 30, 17)
        exam = ReadLine()

        pfGrade = (((q1 + q2) / 2) * 0.2) + (cs * 0.2) + (exam * 0.6)
        SetCursorPosition(Len("Grade:") + x + 30, 18)
        Write(pfGrade.ToString)


        'for made=final
        SetCursorPosition(Len("Q1:") + x + 45, 14)
        q1 = ReadLine()
        SetCursorPosition(Len("Q2:") + x + 45, 15)
        q2 = ReadLine()
        SetCursorPosition(Len("CS:") + x + 45, 16)
        cs = ReadLine()
        SetCursorPosition(Len("Exam:") + x + 45, 17)
        exam = ReadLine()


        fGrade = (((q1 + q2) / 2) * 0.2) + (cs * 0.2) + (exam * 0.6)
        SetCursorPosition(Len("Grade:") + x + 45, 18)
        Write(fGrade.ToString)

        sem_grade = (pGrade * 0.2) + (mGrade * 0.2) + (pfGrade * 0.2) + (fGrade * 0.4)
        SetCursorPosition(Len("Semestral Grade:") + x + 30, 5)
        Write(sem_grade.ToString)

        If sem_grade = 75 Or sem_grade = 76 Then
            equi = 3.0
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 77 Or sem_grade = 78 Or sem_grade = 79 Then
            equi = 2.75
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 80 Or sem_grade = 81 Or sem_grade = 82 Then
            equi = 2.5
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 83 Or sem_grade = 84 Or sem_grade = 85 Then
            equi = 2.25
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 86 Or sem_grade = 87 Or sem_grade = 88 Then
            equi = 2.0
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 89 Or sem_grade = 90 Or sem_grade = 91 Then
            equi = 1.75
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 92 Or sem_grade = 93 Or sem_grade = 94 Then
            equi = 1.5
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 95 Or sem_grade = 96 Or sem_grade = 97 Then
            equi = 1.25
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 98 Or sem_grade = 99 Or sem_grade = 100 Then
            equi = 1.0
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")

        ElseIf sem_grade < 75 Then
            equi = 5.0
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")

        End If



        If sem_grade >= 75 Or sem_grade <= 100 Then
            SetCursorPosition(Len("Remarks:") + x + 30, 7)
            Write("Passed")
        ElseIf sem_grade < 75 Then
            SetCursorPosition(Len("Remarks:") + x + 30, 7)
            Write("Failed")
        Else
            SetCursorPosition(Len("Remarks:") + x + 30, 7)
            Write("Unknown")

        End If

        Call all()
        ReadLine()
    End Sub
    Private Sub student_info()

        SetCursorPosition(x, 5)
        Write("Name:")
        SetCursorPosition(x, 6)
        Write("Gender:")
        SetCursorPosition(x, 7)
        Write("Course:")
        SetCursorPosition(x, 8)
        Write("Subject:")
        SetCursorPosition(x + 30, 5)
        Write("Semestral Grade:")
        SetCursorPosition(x + 30, 6)
        Write("Equivalent:")
        SetCursorPosition(x + 30, 7)
        Write("Remarks:")
        SetCursorPosition(x, 9)
        Write("---------------------------------------------------")

    End Sub
    Private Sub result()
        SetCursorPosition(x, 12)
        Write("Prelim")
        SetCursorPosition(x + 15, 12)
        Write("Midtrem")
        SetCursorPosition(x + 30, 12)
        Write("pre-final")
        SetCursorPosition(x + 45, 12)
        Write("Final")
    End Sub
    Private Sub made()
        SetCursorPosition(x + 15, 14)
        Write("Q1:")
        SetCursorPosition(x + 15, 15)
        Write("Q2:")
        SetCursorPosition(x + 15, 16)
        Write("CS:")
        SetCursorPosition(x + 15, 17)
        Write("Exam:")
        SetCursorPosition(x + 15, 18)
        Write("Grade:")

        'for midterm
        SetCursorPosition(x + 30, 14)
        Write("Q1:")
        SetCursorPosition(x + 30, 15)
        Write("Q2:")
        SetCursorPosition(x + 30, 16)
        Write("CS:")
        SetCursorPosition(x + 30, 17)
        Write("Exam:")
        SetCursorPosition(x + 30, 18)
        Write("Grade:")

        'for pre-final
        SetCursorPosition(x + 45, 14)
        Write("Q1:")
        SetCursorPosition(x + 45, 15)
        Write("Q2:")
        SetCursorPosition(x + 45, 16)
        Write("CS:")
        SetCursorPosition(x + 45, 17)
        Write("Exam:")
        SetCursorPosition(x + 45, 18)
        Write("Grade:")

        'for final
        SetCursorPosition(x, 14)
        Write("Q1:")
        SetCursorPosition(x, 15)
        Write("Q2:")
        SetCursorPosition(x, 16)
        Write("CS:")
        SetCursorPosition(x, 17)
        Write("Exam:")
        SetCursorPosition(x, 18)
        Write("Grade:")
        SetCursorPosition(x, 20)
        Write("Another Entry[Y/N]:")


    End Sub
    Private Sub all()

        SetCursorPosition(Len("Another Entry[Y/N]:") + x + 1, 20)
        chc = ReadLine()

        While chc.ToUpper = "Y".ToUpper
            Call Main()
        End While
        SetCursorPosition(5, 22)
        Write("Press any key to...")
    End Sub
End Module


No comments:

Post a Comment