Write a VB.NET program that accepts registration number, name, gender, unit name and unit code and marks of a student for that unit. Based on the marks of the student, the program should calculate the grade and corresponding comments based on the following grading criteria. If the marks are invalid, i.e. below 0 and more than 100, the program should output an error and prompt the use to enter the marks again. If the marks are correct, the program should display the transcript of the student Use the following grading criteria for your program. Marks Grade Comments Between 70 and 100 A Excellent Between 60 and 69 B Good Between 50 and 59 C Fair Between 40 and 49 D Pass Between 0 and 39 F Fail
Module Module1
Sub Main()
Console.Write("Enter the student registration number: ")
Dim registrationNumber As String = Console.ReadLine()
Console.Write("Enter the student name: ")
Dim name As String = Console.ReadLine()
Console.Write("Enter the student gender: ")
Dim gender As String = Console.ReadLine()
Console.Write("Enter the unit name: ")
Dim unitName As String = Console.ReadLine()
Console.Write("Enter the unit code: ")
Dim unitCode As String = Console.ReadLine()
Dim marks As Integer = -1
Console.Write("Enter the student mark: ")
marks = Integer.Parse(Console.ReadLine())
While marks < 0 Or marks > 100
If marks < 0 Or marks > 100 Then
Console.Write("Wrong mark. Enter the mark again [0-100]: ")
marks = Integer.Parse(Console.ReadLine())
End If
End While
'Marks Grade Comments Between 70 and 100 A Excellent
'Between 60 and 69 B Good Between 50 and 59 C Fair Between 40 and 49 D Pass Between 0 and 39 F Fail
Console.WriteLine()
If marks >= 70 And marks <= 100 Then
Console.WriteLine("A Excellent ")
End If
If marks >= 60 And marks <= 69 Then
Console.WriteLine("B Good")
End If
If marks >= 50 And marks <= 59 Then
Console.WriteLine("C Fair")
End If
If marks >= 40 And marks <= 49 Then
Console.WriteLine("D Pass")
End If
If marks >= 0 And marks <= 39 Then
Console.WriteLine("F Fail")
End If
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment