Answered New to vb, need some help

qaisqais

Member
Joined
Mar 29, 2010
Messages
14
Programming Experience
Beginner
for homework i got this task, however i'm kinda lost (to be made as a console application)

Exam grades
Write a program that asks the user to enter a mark in the range 0 to 100 and outputs the corresponding exam grade, as in the following table:
Mark < 40 40–49 50–59 60–69 70–79 80–100
Grade U E D C B A

at first i tried making if statements for each mark value but then It didnt work out too well, now im thinking maybe I have to use an array ? I'm not really sure how to go about this one..

so far all ive got is

" Dim mark As Integer


Console.WriteLine("Exam Grades" & vbCrLf)
Console.WriteLine("Enter your mark out of 100: ")
mark = Console.ReadLine
"
Someone please help or point me in the right direction, it would be much appreciated
 
Last edited:
You're on the right track and that code will get the grade into your 'mark' variable.

I would look at using a Select Case statement

VB.NET:
        Select Case mark
            Case Is < 40
                Console.WriteLine("U")
            Case Is < 50
                Console.WriteLine("E")
                '...
        End Select

Select Case Statement
 
Thanks, I'll read up on those case statements and test it out.

-Edit

Got it working perfectly with the select case function, thanks alot
 
Last edited:
Back
Top