Answer to Question #269640 in Visual Basic for ian

Question #269640

how to create program that will store three student names with corresponding grades for prelim, midterm, and finals. Compute its average.



1
Expert's answer
2021-11-21T17:33:37-0500
Imports System.IO


Module Module1
    Sub Main()


        For i As Integer = 1 To 3
            Console.Write("Enter name for student {0}: ", i)
            Dim name As String = Console.ReadLine()
            Console.Write("Enter prelim for student {0}: ", i)
            Dim prelim As Double = Double.Parse(Console.ReadLine())
            Console.Write("Enter midterm for student {0}: ", i)
            Dim midterm As Double = Double.Parse(Console.ReadLine())
            Console.Write("Enter finals for student {0}: ", i)
            Dim finals As Double = Double.Parse(Console.ReadLine())


            Console.WriteLine("Average: " + computeAverage(prelim, midterm, finals).ToString())
        Next
       




        Console.ReadLine()
    End Sub
    Function computeAverage(ByVal prelim As Double, ByVal midterm As Double, ByVal finals As Double)
        Return (prelim + midterm + finals) / 3.0
    End Function


End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS