Question: Using the same code for area of the circle. Write a program that requests the user to select one of the shapes, requests the appropriate

Using the same code for area of the circle. Write a program that
requests the user to select one of the shapes, requests the appropriate lengths, width of the rectangle and then
gives the area of the figure. Example of the area of the circle coding, Private Sub btnCompute_Click(...) Handles btnCompute.Click
Dim shapeNum As Integer
Dim radius, length, height, width As Double
'Input choice of shape and its dimensions
'1. Circle 2. Parallelogram 3. Kite
shapeNum = CInt(mtbSelection.Text)
'Mask is 0
Select Case shapeNum
Case 1
radius = CDbl(InputBox("Input the radius of the circle: "))
txtArea.Text = CStr(3.141593* radius ^2)
Case 2
length = CDbl(InputBox("Input the length of the parallelogram: "))
height = CDbl(InputBox("Input the height of the parallelogram: "))
txtArea.Text = CStr(length * height)
Case 3
length = CDbl(InputBox("Input the length of the kite: "))
width = CDbl(InputBox("Input the width of the kite: "))
txtArea.Text = CStr((length * width)/2)
Case Else
MessageBox.Show("Your choice is not valid.", "Try Again.")
mtbSelection.Clear()
End Select
mtbSelection.Focus()
End Sub

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!