Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Triangle
- Public side1 as double
- Public side2 as double
- Public side3 as double
- Public Area as double
- Public Perimeter As double
- Public Sub setSide1 (ByVal w As double)
- side1 = w
- Console.WriteLine(w)
- End Sub
- Public Sub setSide2 (ByVal w As double)
- side2 = w
- Console.WriteLine(w)
- End Sub
- Public Sub setSide3 (ByVal w As double)
- side3 = w
- Console.WriteLine(w)
- End Sub
- Public Sub setArea ()
- Dim halfArea as double
- halfArea = (side1 + side2 + side3) / 2
- Area = halfArea * (halfArea-side1)* (halfArea-side2)* (halfArea-side3)
- Console.WriteLine("Лицето на този триъгълник е: " & Area)
- End Sub
- Public Sub setPerimeter ()
- Perimeter = side1 + side2 + side3
- Console.WriteLine("Периметърът на този триъгълник е: " & Perimeter)
- End Sub
- Public Function getSide1() as double
- Return side1
- End Function
- Public Function getSide2() as double
- Return side2
- End Function
- Public Function getSide3() as double
- Return side3
- End Function
- Public Function getArea() as double
- Return Area
- End Function
- Public Function getPerimeter() as double
- Return Perimeter
- End Function
- End Class
- Sub Main()
- Console.WriteLine("Въведете брои на точки(кратен на 3):")
- Dim MyGivenNumber as Integer
- MyGivenNumber = Console.ReadLine()
- Dim triangleNum as Integer = MyGivenNumber/3
- Console.WriteLine("Броят на получините триъгълници е: " & triangleNum)
- Dim triangleData (triangleNum-1) As Triangle
- Dim max As Integer = triangleNum-1
- For value As Integer = 0 To max step +1
- Console.WriteLine("------")
- triangleData (value) = New Triangle()
- Console.WriteLine("На колко е равна първата страна на триъгълник номер " & value+1)
- triangleData(value).setSide1( Console.ReadLine() )
- Console.WriteLine("На колко е равна втората страна на триъгълник номер " & value+1)
- triangleData(value).setSide2( Console.ReadLine() )
- Console.WriteLine("На колко е равна третата страна на триъгълник номер " & value+1)
- triangleData(value).setSide3( Console.ReadLine() )
- triangleData(value).setArea()
- triangleData(value).setPerimeter()
- Next
- Console.WriteLine("-/-/-/-/-/-")
- dim ss as Integer = theSlowestArea(triangleData, max)
- Console.WriteLine(ss)
- End Sub
- Function theSlowestArea(ByVal triangleData() As Triangle, ByVal triangleNum As Integer) As Integer
- Dim int_max as Integer = 90946
- Dim theNumInTheArray as Integer = 0
- For n as Integer = 0 to triangleNum step+1
- If triangleData(n).getArea() < int_max Then
- int_max = triangleData(n).getArea()
- theNumInTheArray = n
- End If
- Next
- return theNumInTheArray- 1
- End Function
- Function theBiggestArea(ByVal triangleData() As Triangle, ByVal triangleNum As Integer) As Integer
- Dim int_mim as Integer = -90946
- Dim theNumInTheArray as Integer = 0
- For n as Integer = 0 to triangleNum step+1
- If triangleData(n).getArea() > int_min Then
- int_min = triangleData(n).getArea()
- theNumInTheArray = n
- End If
- Next
- return theNumInTheArray- 1
- End Function
- Function theSlowestPerimeter(ByVal triangleData() As Triangle, ByVal triangleNum As Integer) As Integer
- Dim int_max as Integer = 90946
- Dim theNumInTheArray as Integer = 0
- For n as Integer = 0 to triangleNum step+1
- If triangleData(n).getPerimeter() < int_max Then
- int_max = triangleData(n).getPerimeter()
- theNumInTheArray = n
- End If
- Next
- return theNumInTheArray- 1
- End Function
- Function theBiggestPerimeter(ByVal triangleData() As Triangle, ByVal triangleNum As Integer) As Integer
- Dim int_mim as Integer = -90946
- Dim theNumInTheArray as Integer = 0
- For n as Integer = 0 to triangleNum step+1
- If triangleData(n).getPerimeter() > int_min Then
- int_min = triangleData(n).getPerimeter()
- theNumInTheArray = n
- End If
- Next
- return theNumInTheArray- 1
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement