Hello friends,
I recently bought your book "C How to Program" Introducing C++ and Java 3rd Edition.

I was solving the exercises in all the chapters. But iam stuck with the following question. Certainly iam not a student and this is not my assignment. Moreover i don't need the program,just the formula.

==================================
Write an inheritance hierarchy for class Quadrilateral, Trapezoid, SymmetricTrapezoid,
Parallelogram, Rectangle, and Square. Use Quadrilateral as the base class of the
hierarchy. Make the hierarchy as deep (i.e., as many levels) as possible. The private data of
Quadrilateral should be (x, y) coordinate pairs for the four endpoints of the Quadrilateral.
Supply virtual functions double area(), double periphery(), point middle() (an
intersection of diagonals).
Write a driver program that instantiates and displays objects of each of these classes and tests all the
functions. Test at least 2 objects of each class. As you create each Quadrilateral, place a
Quadrilateral* pointer to each new Quadrilateral object into an array.

==================================

I have 2 doubts. Please clarify them.

1. What is known as periphery? Does it mean perimeter? If it doesn't then please give the formula for calculating it for all the shapes.

2. Can you please give me the formula for calculating the area, periphery and middle for the
Trapezoid and Symmetric Trapezoid. I remember the formulas for other shapes.

(2) Area of a trapazoid with height h and bottom base length b1 and top base length b2 (bases are the parallel sides: (b1 + b2)/2 * h; it doesn't matter whether or not it is symetric: the central rectangle yeilds b2*h for the area and the remaining tail ends can be combined into a triangle with height h and base b1-b2 and the area of that is (b1 - b2) * h / 2 so total area is

h * (b2 + (b1 - b2)/2) = h * (b2 + b1/2 - b2/2) = h * (b1 + b2)/2

and the perimiter is the sum of the length of all the sides but if your only given h, b1 and b2 you can't determine it. you need another peice of information, something like the seperation of the top and bottom.

s
<-->_____b2_________
/| \
/ | h \
/__|____________________\
<------------------------------->
b1

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

(2) Area of a trapazoid with height h and bottom base length b1 and top base length b2 (bases are the parallel sides: (b1 + b2)/2 * h; it doesn't matter whether or not it is symetric: the central rectangle yeilds b2*h for the area and the remaining tail ends can be combined into a triangle with height h and base b1-b2 and the area of that is (b1 - b2) * h / 2 so total area is

h * (b2 + (b1 - b2)/2) = h * (b2 + b1/2 - b2/2) = h * (b1 + b2)/2

-bcl