Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To Be Done in Visual Basic Code Chapter 6 Functions Programming Exercise #7 Test

ID: 3891249 • Letter: T

Question

To Be Done in Visual Basic Code

Chapter 6 Functions Programming Exercise #7 Test Average and Grade

Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program:

calcAverage—This function should accept five test scores as arguments and return the average of the scores.

determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale:

Score Letter Grade

90–100 A

80–89 B

70–79 C

60–69 D

Below 60 F

Explanation / Answer

Hello,

I have written VB.net code for above problem.

Imports System

Imports System.Collections.Generic

Imports System.Linq
Imports System.Text.RegularExpressions

Namespace std
    Public Module Program
  
        Public Function calcAvg(ByVal x1 As Integer,ByVal x2 As Integer,ByVal x3 As Integer,ByVal x4 As Integer,ByVal x5 As Integer) As Double
            Return (x1+x2+x3+x4+x5)/5
        End Function
      
        Public Function determineGrade(ByVal grade As Integer) As String
            Dim ret = ""
            If grade <= 100 And grade >= 90 Then
                ret = "A"
            End If
            If grade <= 89 And grade >= 80 Then
                ret = "B"
            End If
            If grade <= 79 And grade >= 70 Then
                ret = "C"
            End If
            If grade <= 69 And grade >= 60 Then
                ret = "D"
            End If
            If grade < 60 Then
                ret = "F"
            End If
            Return ret
        End Function
      
        Public Sub Main(args() As string)
           Dim x1,x2,x3,x4,x5 As Integer
           Dim avg As Double
           Dim s As String
           Console.WriteLine("Enter five test Scores: ")
           x1 = CInt(Console.ReadLine())
           x2 = CInt(Console.ReadLine())
           x3 = CInt(Console.ReadLine())
           x4 = CInt(Console.ReadLine())
           x5 = CInt(Console.ReadLine())
           avg = calcAvg(x1,x2,x3,x4,x5)
           Console.WriteLine("Average Score = "&avg)
           s = determineGrade(x1)
           Console.WriteLine("Grade for x1 = "&s)
           s = determineGrade(x2)
           Console.WriteLine("Grade for x2 = "&s)
           s = determineGrade(x2)
           Console.WriteLine("Grade for x3 = "&s)
           s = determineGrade(x4)
           Console.WriteLine("Grade for x4 = "&s)
           s = determineGrade(x5)
           Console.WriteLine("Grade for x5 = "&s)
        End Sub
    End Module
End Namespace

Thank you so much!!!

And feel free to ask updatations/modifications or queries.

I'm here to help you!!! :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote