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
====================================================================
===========================================================

VB-67 : Reverse a String

Write a VB program to accept a string from the user and write a f`unction to reverse the string.Ignore all leading and tailing spaces in the input string.Display the reversed string in a message box.


Compare the same type of program I did in JAVA , the link is Reverse a number



Refer Reverse a given 5 digit number also.

(A)Program Design : 



(B) Property(Controls Used) :

  • Label with Caption Input Text
  • One TextBox
  • One Command Button ( Reverse Text)

(C) Attaching Code to the Object :

Private Sub Command1_Click()
MsgBox StrReverse(Trim(Text1))
End Sub


(D) Output :







====================================================================
===========================================================

VB-66 : Pay Slip of an Employee

Develop a small application to find the Gross salary and Net salary by taking the inputs BASIC,HRA,DA,CONVEYANCE and DEDUCTIONS (LIC,INCOME-TAX, LOANS, etc.)

This application calculates HRA,DA,CONVEYANCE  as follows :
15% of Basic as HRA
40% of Basic as DA
Rs.800 as the fixed conveyance for all.
Gross Salary = Basic Salary +HRA+DA+Conveyance
Net Salary = Gross Salary-(Loan+Income Tax+LIC+Others)

Refer Calculate the Gross & Net Salary of an Employee  and  Create an Employee Profile


(A)Program Design : 


(B) Property(Controls Used) :

  • 10 Labels

  • 10 Text Boxes (Name BASIC-Text1,HRA-Text2,DA-Text3...........NET SALARY-Text10 respectively)

  • One Command Button ( Calculate)



  • (C) Attaching Code to the Object :

    Private Sub Command1_Click()
    If Text1 = "" Then
    MsgBox "Basic must be specified"
    Text1.SetFocus
    Exit Sub
    End If

    If Text5 = "" Then
    Text5 = 0
    End If

    If Text6 = "" Then
    Text6 = 0
    End If

    If Text8 = "" Then
    Text8 = 0
    End If

    If Text7 = "" Then
    Text7 = 0
    End If

    Text2 = Text1 * 15 / 100
    Text3 = Text1 * 40 / 100
    Text4 = Text1 * 10 / 100
    Text9 = CSng(Text1) + CSng(Text2) + CSng(Text3) + CSng(4)
    Text10 = CSng(Text9) - CSng(Text5) - CSng(Text6) - CSng(Text7) - CSng(8)
    End Sub


        • ====================================================================
          Back to Home   &  VB
      ===========================================================