Answer to Question #16962 in Visual Basic for anant raj gupta

Question #16962
desgn a for to accept the name of the student and marks in 5 subjects. calculate the average marks obtained . grade the student as follow
marks<=40 D grade
marks>=40 And =<60 C grade
marks>=60 And=<75 B grade
marks>=75 A grade
i want coding for this
1
Expert's answer
2012-10-23T09:32:30-0400
Module Module1




Sub Main()

Dim Sum As Double

Dim Average As Double

Dim LetterGrade As String

Sum = 0

For index As Integer = 1 To 5

Console.WriteLine("Please enter a grade")

Sum = Sum + Convert.ToDouble(Console.ReadLine())

Next

Average = Sum / 5

Console.WriteLine("The average grade: {0}", Average.ToString())

Select Case Average

Case Is > 90

LetterGrade = "A"

Case 80 < Average < 90

LetterGrade = "B"

Case 70 < Average < 80

LetterGrade = "C"

Case 60 < Average < 70

LetterGrade = "D"

Case Else

LetterGrade = "F"

End Select

Console.WriteLine(LetterGrade);

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
APPROVED BY CLIENTS