public sub lab4() \'define thr main program \'define variables Dim h,b,r,l,w,at,
ID: 3698286 • Letter: P
Question
public sub lab4()
'define thr main program
'define variables
Dim h,b,r,l,w,at, ac, ar, atotal as Double
h = 10.1
b = 7
r = 2.5
l = 7.1
w = 3.6
Call areatriangle ((h), (b))
Call areacircle ((r))
Call arearectangle ((l, (w))
Call sum ((at), (ac), (ar))
MsgBox atotal
End Sub
Public Sub areatriangle (h,b)
dim a, at as double
a = (b*h)/2 at= a
end sub
Public Sub areacircle(r)
Dim a, ac as double
a = 3.14 * (r^2)
ac = a
end sub
Public Sub arearectangle (l,w)
Dim a, ar as double
a = l*w ar = a
End sub
Public Sub sum(a,b,c)
Dim tot, atotal as double
tot = a+b+c
atotal = tot
end sub
-----------please debug this program------- thanks
Explanation / Answer
Public Sub lab4()
'define thr main program
'define variables
Dim h, b, r, l, w, at, ac, ar, atotal As Double
h = 10.1
b = 7
r = 2.5
l = 7.1
w = 3.6
Call areatriangle((h), (b))
Call areacircle((r))
Call arearectangle((l), (w))
Call sum((at), (ac), (ar))
MsgBox(atotal)
End Sub
Public Sub areatriangle(h, b)
Dim a, at As Double
a = (b * h) / 2
at = a
End Sub
Public Sub areacircle(r)
Dim a, ac As Double
a = 3.14 * (r ^ 2)
ac = a
End Sub
Public Sub arearectangle(l, w)
Dim a, ar As Double
a = l * w
ar = a
End Sub
Public Sub sum(a, b, c)
Dim tot, atotal As Double
tot = a + b + c
atotal = tot
End Sub
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.