以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]根据ABCD计算平均分的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=138492)

--  作者:81538475
--  发布时间:2019/8/1 18:27:00
--  [求助]根据ABCD计算平均分的问题
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.foxdb


麻烦帮忙看看这个如何计算把。
表格中时以A,B,C,D来评分
最后根据下面的对应数字来计算平均分。然后在转换成  A,B,C,D来显示。

Dim s As String
    Dim str As double = 0
    Dim A As Integer = 10
    Dim B As Integer = 8
    Dim C As Integer = 6
    Dim D As Integer = 1
    For Each dr As DataRow In drs
        
        str= str + dr("评分")
    Next
    STR = STR/DRS.Count
    If STR < 2 AndAlso STR > 0 Then
        S= "D-"
    Else If STR >=2 AndAlso STR < 4 Then
        S= "D"
    Else If STR >=4 AndAlso STR < 5 Then
        S="C-"
    Else If STR >=5 AndAlso STR < 7 Then
        S="C"
    Else If STR >=7 AndAlso STR < 8 Then
        S="B-"
    Else If STR >=8 AndAlso STR < 9 Then
        S="B"
    Else If STR >=9 AndAlso STR <= 10 Then
        S="A"
    End If
 msgbox(S)


--  作者:y2287958
--  发布时间:2019/8/1 19:16:00
--  
没看明白
--  作者:y2287958
--  发布时间:2019/8/1 19:37:00
--  
Dim dic As New Dictionary(Of String, Integer)
dic.add("A",10)
dic.add("B",8)
dic.add("C",6)
dic.add("D",1)
Dim STR As String= 0
For Each dr As DataRow In DataTables("表A").DataRows
    STR += dic(dr("评分"))
Next
STR = STR/DataTables("表A").DataRows.Count
Dim s As String
If STR < 2 AndAlso STR > 0 Then
    S= "D-"
Else If STR >=2 AndAlso STR < 4 Then
    S= "D"
Else If STR >=4 AndAlso STR < 5 Then
    S="C-"
Else If STR >=5 AndAlso STR < 7 Then
    S="C"
Else If STR >=7 AndAlso STR < 8 Then
    S="B-"
Else If STR >=8 AndAlso STR < 9 Then
    S="B"
Else If STR >=9 AndAlso STR <= 10 Then
    S="A"
End If
msgbox(S)

--  作者:81538475
--  发布时间:2019/8/1 19:53:00
--  
多谢多谢