PRF193_PE_SP25_102556_3495.webp
May76

PRF193_PE_SP25_102556_3495.webp

  • Media owner May76
  • Ngày thêm
Kizspy.me
4 of 4
Paper No: 1
The given Q4.cpp 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)
+getPerimeter ():double
+ getArea():double
Where:

Triangle(edgeA: int, edgeB: int, edgeC: int)
- parameterized constructor, which sets
values to three edges of a triangle: edgeA,
edgeB and edgeC
.getPerimeter ():double-return the
perimeter of the triangle, which is the
sum of three edges
⚫ getArea():double-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
Enter edge C: 1
Enter edge C: 2
Enter edge C: 1
1.Test getPerimeter()
1.Test
getPerimeter()
2.Test getArea()
2.Test getArea()
1.Test
getPerimeter()
2.Test getArea()
Enter edge C: 2
1.Test getPerimeter()
Enter TC(1/2):1
2.Test getArea()
Enter TC(1/2):2
+ 100%
Zoom
Close
Chưa có bình luận nào.

Thông tin

Category
PRF193
Thêm bởi
May76
Ngày thêm
Lượt xem
913
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom