✓ Kizspy.me
Output for marking:
OUTPUT:
2
Output for marking:
OUTPUT:
3
Question 4: (2 marks)
The given Q4.py file contains statements about input and output data of objects from the Triangle class.
You should write the statements to complete the Triangle class as described below:
-edgeA: int
-edgeB: int
-edgeC: int
Triangle
+ Triangle(edgeA: int, edgeB: int, edgeC: int)
+ get_perimeter():float
+ get_area():float
Where:
• Triangle(edgeA: int, edgeB: int, edgeC: int)
- parameterized constructor, which sets
values to three edges of a triangle: edgeA,
edgeB and edgeC

get_perimeter():float - return the
perimeter of the triangle, which is the
sum of three edges
get_area ():float-return the area of the
Triangle. The area is calculated by the
formula: S-sqrt(p*(p-edgeA)*(p-
edgeB)*(p-edgeC)), which p is half of the
perimeter of the Triangle
Notes:
-You can create new function(s) if you see it is necessary.
-Do not edit given statements in the main function.
Sample input and output:
Enter edge A: 1
Enter edge A: 2
Enter edge A: 1
Enter edge A: 2
Enter edge B: 1
Enter edge B: 3
Enter edge B: 1
Enter edge B: 3
+ 100%
Zoom
Close