Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Tuesday, July 26, 2011

VB-68 : Program to calculate a student's grade

Create a VB program to calculate a student's grade based on upto 5 projects and 4 tests. Create one or more control arrays of text boxes and appropriate labels to accept the scores gained by the student.
Refer   To determine whether a student is passed or not also.

(A)Program Design : 





(B) Property(Controls Used) :

  • Proper Labels to Text Boxes (Test1 ,Test2,...Project2,Grade...etc)
  • 5 TextBoxes - Name-txt_test , Index - 0 to 4
  • 6 TextBoxes - Name-txt_prj  , Index- 0 to 5
  • 3 TextBoxes - Name - txt_total , txt_per & txt_grade , Locked-True 
  • One Command Button - Caption - Calculate , Name - cmd_cal
(C) Attaching Code to the Object :

Private Sub cmd_cal_Click()
Dim sum As Integer
Dim per As Single
Dim fail As Boolean
fail = False

For i = 0 To 3
sum = sum + Val(txt_test(i).Text)
If Val(txt_test(i).Text) < 35 Then fail = True
Next
txt_test(4) = sum

sum = 0
For i = 0 To 4
If Val(txt_prj(i).Text) < 35 Then fail = True
Next
txt_prj(5) = sum

sum = Val(txt_test(4)) + Val(txt_prj(5))
per = (sum) / 900 * 100

txt_total = sum
txt_per = per

If fail = True Then
txt_grade = "Fail"
Else
Select Case (per)
Case Is >= 70:
txt_grade = "Distinction"
Case Is >= 60:
txt_grade = "First"
Case Is >= 50:
txt_grade = "Second"
Case Else
txt_grade = "Pass"
End If
End Sub
====================================================================
===========================================================

1 comment:

Unknown said...

good program am gonna try it out