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.
- ====================================================================
No comments:
Post a Comment