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

Friday, July 29, 2011

VB-73 : Calculate Area & Volume


Write a VB program for a company to produce various sized basketballs , to calculate the area and volume of different sized balls,so that they will know how much air to pump in the ball,and how much paint they will need to paint it.Radius may be taken from the user as input of the program.
Area=4*22/7*(Radius)^2
Volume=4/3 * 22/7 * (Radius)^3
======================================
 (A)Program Design : 

(B) Property(Controls Used) :
  • 3 Labels
  • 3 TextBoxes(Text 1,2,3)
  • One Command Button (Calculate)

(C) Attaching Code to the Object :
Private Sub Command1_Click()
Dim radius As Single
Dim area, volume As Double

radius = Val(Text1)
area = 4 * 22 / 7 * (radius * radius)
volume = 4 / 3 * 22 / 7 * (radius * radius * radius)

Text2 = Round(area, 2)
Text3 = Round(volume, 2)
End Sub



(D) Output :
(E) Errors :
If found any errors while running your VB program, please click this link   Possible Errors while running VB Programs to get a solution.

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

    No comments: