In: Computer Science
Write a program that reads a student's code and grades from all four tests of any matter; and calculate and print the final grade for the subject, along with the student code. Taking into account that: The value of the first is 15% The value of the second is 25% The value of the third is 30% The value of the fourth is 40%
Programming language is VB8
Code
Module Module1
Sub Main()
Dim id As String 'varibale that stores the student id
''forur int variables that stores the four test score
Dim test1, test2, test3, test4 As Integer
'ask user for student id
Console.Write("Enter Student id: ")
id = Console.ReadLine()
'ask user for four test grade
Console.Write("Enter grade for test 1: ")
Integer.TryParse(Console.ReadLine(), test1)
Console.Write("Enter grade for test 2: ")
Integer.TryParse(Console.ReadLine(), test2)
Console.Write("Enter grade for test 3: ")
Integer.TryParse(Console.ReadLine(), test3)
Console.Write("Enter grade for test 4: ")
Integer.TryParse(Console.ReadLine(), test4)
Dim finalGrade As Double
''calculate finalGrade
finalGrade = test1 * 0.15 + test2 * 0.25 + test3 * 0.3 + test4 *
0.4
''print the final input
Console.WriteLine(vbCrLf & "Student ID: " & id)
Console.WriteLine("Finale Grade: " & Math.Round(finalGrade,
2))
End Sub
End Module
output
If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.