通过期中和期末计算成绩

时间:2015-10-14 00:52:48

标签: vb.net

对于我在Visual Basic中的课程,我需要根据期中考试和最终考试的分数来计算学期成绩。我的问题是,决赛必须算作两次中期的数量,我继续得到超过100的数字。这是我到目前为止,

    Private Sub btnDet_Click(sender As Object, e As EventArgs) Handles btnDet.Click
        Dim mid As Double = CDbl(txtMid.Text)
        Dim final As Double = CDbl(txtMid.Text)
        Dim grade As Double = (mid + final + final) / 2
        Math.Ceiling(grade)
        lblGrade.Text = CStr(grade)
    End Sub

...

1 个答案:

答案 0 :(得分:2)

为什么不考虑中期的1/3等级,最后的2/3等级?因此,在代码中,您只需将mid * 0.33final * 0.66相乘,并将这些加在一起就可以得到您的成绩。

这是我的思考过程:

Private Sub btnDet_Click(sender As Object, e As EventArgs) Handles btnDet.Click Dim mid As Double = CDbl(txtMid.Text) * 0.33 Dim final As Double = CDbl(txtMid.Text) * 0.66 Dim grade As Double = mid + final Math.Ceiling(grade) lblGrade.Text = CStr(grade) End Sub