我正在制作计算成绩的计划。 我的patricipation得分取决于你错过了几天的课程。
这是我想要编程的内容。
我将我的日子保存为用户输入视为AB1。
然后,AB2应该是我的patricipation得分
Patricipation得分基于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
答案 0 :(得分:1)
If 2 < AB1 < 8 Then
可能不会做你的想法。它应该是
IF 2 < AB1 ANDALSO AB1 < 8 THEN...