Using/creating 4 VB Classes, create a single Windows Form application to calcula
ID: 3677177 • Letter: U
Question
Using/creating 4 VB Classes, create a single Windows Form application to calculate the centroid and area of the 3 common shapes below: Create a Base (Parent) Class named clsShape containing 3 properties (Base, Height, Diameter)Create an additional 3 derived sub-classes named clsSquare, clsTriangle, clsCircle which Inherits the properties of the Base Class. For each of the derived classes, create 3 methods (functions) calculate the centroid (X and Y) and the Area In a Windows Form 1, create an instance (object) for each derived class named objSquare, objTriangle. objCircle For example: Dim objSquare as New clsSquareExplanation / Answer
Public Class Formhere
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = 3.14 * TextBox1.Text //area of circle 3.14*r*r
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox5.Text = TextBox3.Text * TextBox4.Text //rectangle=length *breadth
End Sub
//area of triangle->
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim p As Integer = TextBox6.Text
Dim q As Integer = TextBox7.Text
Dim r As Integer = TextBox8.Text
Dim s As Double = (p + q + r) / 2
Dim findarea As Double = Math.Sqrt(s * (s - p) * (s - q) * (s - r))
TextBox9.Text = findarea
End Sub
End Class
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.