我正在制作一个计算成绩的程序。我的参与分数是基于你缺课的天数。
这是我想要编程的。
根据用户输入,我将错过的日子保存为 AB1。
那么 AB2 应该是我的参与分数
参与分数是基于 100 分 如果你错过了 2 节课,那么你有 100 分。然后,在 2 之后的每一天,您错过了 20 分。你也不能负分。所以这就是我想说的。
如果您错过 2 天或更短的时间。您的参与分数是 100。如果您错过 3 到 6 天,您的分数是 80,60,40,20 如果您错过 7 天或更多,您的分数是 0。
Sub Main()
Dim TG1 As Integer = -1
While TG1 < 0 Or TG1 > 200
Console.WriteLine("Please enter your grade for project #1 <0-200>: ")
TG1 = Console.ReadLine()
End While
Dim TG2 As Integer = -1
While TG2 < 0 Or TG2 > 200
Console.WriteLine("Please enter your grade for project #2 <0-200>: ")
TG2 = Console.ReadLine()
End While
Dim TG3 As Integer = -1
While TG3 < 0 Or TG3 > 200
Console.WriteLine("Please enter your grade for project #3 <0-200>: ")
TG3 = Console.ReadLine()
End While
Dim MT1 As Integer = -1
While MT1 < 0 Or MT1 > 150
Console.WriteLine("Please enter your grade on the midterm <0-150>: ")
MT1 = Console.ReadLine()
End While
Dim AB1 As Integer = -1
While AB1 < 0 Or AB1 > 30
Console.WriteLine("Please enter how much you were absent <0-30>: ")
AB1 = Console.ReadLine()
End While
Dim AB2 As Integer
If AB1 <= 2 Then AB2 = 100
If 2 < AB1 < 8 Then AB2 = 100 - ((AB1 - 2) * 20)
If AB1 > 7 Then AB2 = 0
Dim GSF As Integer
GSF = TG1 + TG2 + TG3 + MT1 + AB2
Dim PNA As Integer
PNA = 900 - GSF
Dim PeNA As Integer
PeNA = PNA / 150
Console.WriteLine("------------------------------------------------")
Console.WriteLine("--GRADE SUMMARY--")
Console.WriteLine("Project #1 : {0}", TG1)
Console.WriteLine("Project #2 : {0}", TG2)
Console.WriteLine("Project #3 : {0}", TG3)
Console.WriteLine("Midterm Exam : {0}", MT1)
Console.WriteLine("Participation : {0}", AB2)
Console.WriteLine("-------------------------------------------------")
Console.WriteLine("Total grade so far: {0}", GSF)
Console.WriteLine("")
Console.WriteLine("{0} {1} {2}", "Desired grade".PadRight(20), "Points needed".PadRight(20), "Percentage needed on final")
Console.WriteLine("{0} {1} {2}", "A".PadRight(20), PNA.ToString.PadRight(20), PeNA.ToString.PadRight(20))
'A - 900-1000
'B - 800-899
'C - 700-799
'D - 600-699