Write a VB program to find the average sales. Read sales from January to June then find average of them.
====================================================================
(A)Program Design :
(B) Property(Controls Used) :
- 6 Labels and 6 textboxes (Name Text1 to 6 respectively)
- Two Command Buttons (Find Average and Exit)
- One TextBox to display average (Text7)
(C) Attaching Code to the Object :
Dim jan, feb, mar, apr, may, june Dim avg As Double |
Private Sub Command1_Click() jan = CInt(Text1.Text) feb = CInt(Text2.Text) mar = CInt(Text3.Text) apr = CInt(Text4.Text) may = CInt(Text5.Text) june = CInt(Text6.Text) avg = (jan + feb + mar + apr + may + june) / 6 Text7.Text = avg End Sub |
Private Sub Command2_Click() Unload Me End Sub |
(D) Output :
(E) Errors :
If found any errors while running your VB program, or want to put your comment about any program , please click Comment section , to post.
====================================================================
No comments:
Post a Comment