Answer to Question #209552 in Visual Basic for Yuvan

Question #209552

In Visual Basic, the Select Case structure performs one of many actions (or sequences of actions), depending on the value of an expression. 

(a) Write a program using Select...case block that prompts a user for an exam score. The grade to be dispayed is based on the Table 1 below.

Table 1: Exam Score

Score

Grade

90-100

A

80-89

B

70-79

C

60-69

D

0-59

F



1
Expert's answer
2021-06-22T07:23:59-0400
Module Module1
   


    Sub Main()
        Dim examScore As Integer
        Console.Write("Enter exam score: ")
        Integer.TryParse(Console.ReadLine(), examScore)


        Dim grade As String = "Wrong exam score"
        Select Case examScore
            Case 90 To 100
                grade = "A"
            Case 80 To 89
                grade = "B"
            Case 70 To 79
                grade = "C"
            Case 60 To 69
                grade = "D"
            Case 0 To 59
                grade = "F"
        End Select
        Console.WriteLine("Your grade is: {0}", grade)
        Console.ReadLine()
    End Sub




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