Design a class to overload functions area() as follows:
1.double area(int a,int b,int height)- returns the area of a trapezium using the formula:
AREA=1/2height(a+b)
Answers
Answered by
1
Answer:
We mark the points on the graph and get the triangle ABC as shown in the figure
The required area of triangle = area of DABD + area of trapezium EDEC − area of DACE
Equation of line AB⇒y=
2
3
(x+1)
Equation of line BC⇒y=−
2
x
+
2
7
Equation of line AC⇒y=
2
x
+
2
1
∴ Area of △ABC=∫
−1
1
(
2
3
x+
2
3
)dx+∫
1
3
(−
2
x
+
2
7
)dx+∫
−1
3
(
2
x
+
2
1
)dx
=[
4
3x
2
+
2
3
x]
−1
1
+[
4
−x
2
+
2
7
x]
1
3
−[
4
x
2
+
2
3
x]
−1
3
=(
4
3
+
2
3
−
4
3
+
2
3
)+(
4
9
+
4
21
+
4
1
−
2
7
)−(
4
9
+
4
3
−
4
1
+
4
1
)
=3+(
4
−9+42+1−14
)−(
4
9+6−1+2
)
=3+5−4=4 sq units
Similar questions
Math,
4 months ago
English,
4 months ago
Math,
9 months ago
Computer Science,
9 months ago
Math,
1 year ago