PLEASE REMEMBER THAT -Using/creating 4 VB Classes , create a single Windows Form
ID: 3679290 • Letter: P
Question
PLEASE REMEMBER THAT
-Using/creating 4 VB Classes, create a single Windows Form application to calculate the centroid and area of the 3 common shapes: Triangle, Circle and Rectangle
-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 clsSquare
Using/creating 4 VB Classes, create a single Windows Form application to calculate the centroid and area of the 3 common shapes below: Right Triangle Rectang The centroid of a square or rectangle is The centroid of a right triangle is located at a located at a distance of 1/2 its height and 1/2 distance of 113 its height and 1/3 its base. H Centroid Area (b)(h) Area b)(h both Cx d Cy 3r Area A-TD Class Diagram Base Single Properties Height Single Diameter Single CenX 0: Single Area): Single Area0C Single CentX0 Area Single Create a Base (Parent) Class named clsshape containing 3 properties (Base, Height, Diameter) Create an additional 3 derived sub-classes named clsSquare, clsTriangle, cls circle 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 bis obiTriangle, bici For example: DimobiSquare as New clsSquare he V Studio S Solution Explorer Search Solution Explorer (Ctrl+:) Windows Ap My Project nfig VB clsCircle.vb D vB gle.vb D clsTriangle.vb Sample Windows Form oop Application forcentroids and Area Enter Base Value Enter Height Value Enter Diameter Value Cent Cent Cert (P) Cert CertExplanation / Answer
Public Class FormAREA
//area of cicrcle 3.14*r*r
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = 3.14 * TextBox1.Text
End Sub
//to calculate area of rectangle length*breadth
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox5.Text = TextBox3.Text * TextBox4.Text
End Sub
//to calculate area of triangle
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim aside As Integer = TextBox6.Text
Dim bside As Integer = TextBox7.Text
Dim cside As Integer = TextBox8.Text
Dim s As Double = (aside + bside + cside) / 2
Dim findarea As Double = Math.Sqrt(s * (s - aside) * (s - bside) * (s - cside))
TextBox9.Text = findarea
End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.