Source Code



Search Data Array (Static)

  • M. Taufik
  • Mar 24' 14
  • VB.NET
  • 315
  • 67
  • United States


Module SearchArray_Static
    Sub main()
        Dim test(,), count As String
        Dim j As Integer
        Dim average, midtest, endtest As Decimal
        Dim colmn As Integer = 3

        Console.BackgroundColor = ConsoleColor.White
        Console.ForegroundColor = ConsoleColor.Black
        Console.WriteLine("APPLICATION STUDENT'S SCORE TEST", Console.Title)
        Console.WriteLine()
        Console.ResetColor()
        Console.Write("How Many Student Data to be Entered = ")
        count = Console.ReadLine()
        Do Until IsNumeric(count)
            Console.ForegroundColor = ConsoleColor.Red
            Console.WriteLine("Sorry Couldn't Be Continued, Must be Enter Number!")
            Console.ResetColor()
            Console.Write("How Many Student Data to be Entered = ")
            count = Console.ReadLine()
        Loop
        ReDim test(count - 1, colmn)

        For i = 0 To test.GetUpperBound(0)
            Console.WriteLine()
            j = 0
            Console.Write("Name Of Student = ")
            test(i, j) = Console.ReadLine()
            j += 1
            Console.Write("Student's Score of Mid Test = ")
            test(i, j) = Console.ReadLine()
            Do Until IsNumeric(test(i, j))
                Console.ForegroundColor = ConsoleColor.Red
                Console.WriteLine("Sorry Scores Must be Number! ")
                Console.ResetColor()
                Console.Write("Student's Score of Mid Test = ")
                test(i, j) = Console.ReadLine()
            Loop
            j += 1
            Console.Write("Student's Score of End Test = ")
            test(i, j) = Console.ReadLine()
            Do Until IsNumeric(test(i, j))
                Console.ForegroundColor = ConsoleColor.Red
                Console.WriteLine("Sorry Scores Must be Number! ")
                Console.ResetColor()
                Console.Write("Student's Score of End Test = ")
                test(i, j) = Console.ReadLine()
            Loop
            midtest = test(i, 1)
            endtest = test(i, 2)
            average = (midtest + endtest) / 2
            j += 1
            test(i, j) = average
        Next
        Console.WriteLine()
        Console.WriteLine()
        Console.WriteLine("--------- LIST STUDENT'S SCORES ---------")
        Console.WriteLine("=========================================")
        Console.WriteLine("NO.  Name     MidTest   EndTest   Average ")
        Console.WriteLine("=========================================")
        For i = 0 To test.GetUpperBound(0)
            Console.WriteLine("{0}    {1}{2}{3}{4}  {5}{6}    {7:f}", i + 1, test(i, 0),
                              vbTab, test(i, 1), vbTab, test(i, 2), vbTab, test(i, 3))
            If i <> test.GetUpperBound(0) Then
                Console.WriteLine("-----------------------------------------")
            Else
                Console.WriteLine("=========================================")
            End If
        Next
        Console.ForegroundColor = ConsoleColor.Green
        Console.WriteLine()
        Dim result As String
        Dim nom As Integer = 1
        Console.WriteLine("The Result of Students Whose Average Score More Than 8 ")
        Console.WriteLine("=========================================")
        Console.WriteLine("NO.  Name     MidTest   EndTest   Average ")
        Console.WriteLine("=========================================")
        For i = 0 To test.GetUpperBound(0)
            result = (test(i, 3) > 8)
            If result = True Then
                Console.WriteLine("{0}    {1}{2}{3}{4}  {5}{6}    {7:f}", nom, test(i, 0),
                                  vbTab, test(i, 1), vbTab, test(i, 2), vbTab, test(i, 3))
                nom += 1
                If i <> test.GetUpperBound(0) Then
                    Console.WriteLine("-----------------------------------------")
                Else
                    Console.WriteLine("=========================================")
                End If
            End If
        Next
        Console.ResetColor()
        Console.WriteLine()
    End Sub
End Module
  • Tags :
comments powered by Disqus

Related Code

List Data Student By Array Multidimensi

Find The Maximun, Minimum and Average by Array Season II

Find The Maximun, Minimum and Average by Array

Know the number of odd or even !

Check two files are equal

Define binary type

Coloring Cells in a DBGrid

Coloring Cells in a StringGrid

Disable the Close X button on a Form

Activating the Start Menu by Code



Category