Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Rextester.Program.Main is the entry point for your code. Don't change it.
- 'Compiler version 11.0.50709.17929 for Microsoft (R) .NET Framework 4.5
- Imports System
- Imports System.Collections.Generic
- Imports System.Linq
- Imports System.Text.RegularExpressions
- Namespace Rextester
- Public Module Program
- Public Sub Main(args() As string)
- Dim score As Integer
- 'get user input
- Console.Writeline("\n\tEnter score: ")
- score= Console.ReadLine()
- 'show grade
- Console.WriteLine("\n\tYour grade: " & calcGrade(score) )
- End Sub
- 'convert number score to letter grade
- Function calcGrade(ByVal sco As Double) As String
- Dim gra As String
- 'detect invalid score
- If sco<0 Or sco>100 Then
- gra= "invalid"
- return gra
- End If
- Select Case sco
- Case >=90
- gra= "A"
- Case >=80
- gra= "B"
- Case >=70
- gra= "C"
- Case >=60
- gra= "D"
- Case Else
- gra= "F"
- End Select
- return gra
- End Function
- End Module
- End Namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement