# 1. Quadrilateral Inheritance Hierarchy
- Write an inheritance hierarchy for classes **Quadrilateral (四邊形)**, **Trapezoid(梯形)**, **Parallelogram(平行四邊形)**, **Rectangle(長方形)**, and **Square(正方形)**
- The inheritance hierarchy(繼承關係):

- Specify the instance variables, properties and methods for each class
- The private instance variables of Quadrilateral should be the **x-y coordinate pairs for the four endpoints of the Quadrilateral** (四邊形四個點的座標x, y)
- So you need to declare $4 * 2 = 8$ variables
## Hint
- Declare double variables **x1, y1, x2, y2, x3, y3, x4, y4** in **Quadrilateral class**
- Use **get** accessor in Quadrilateral class to let the **derived classes(子類別)** obtain the private instance variables
- Area Formula for the Quadrilateral
```csharp
Math.Abs(x1 * y2 + x2 * y3 + x3 * y4 + x4 * y1 - x2 * y1 - x3 * y2 - x4 * y3 - x1 * y4) / 2
```
You can use this formula directly in all derived classes
## Demo
- Write a program that instantiates (建立) objects of your classes and outputs each object’s area (**except Quadrilateral**)
- **Example Test Code( 8 variables ):**
```csharp
Trapezoid t = new Trapezoid(2, 5, 8, 5, 10, 0, 0, 0);
Console.WriteLine(t.Area());
Parallelogram p = new Parallelogram(2, 5, 7, 5, 5, 0, 0, 0);
Console.WriteLine(p.Area());
Rectangle r = new Rectangle(0, 5, 8, 5, 8, 0, 0, 0);
Console.WriteLine(r.Area());
Square s = new Square(5, 0, 5, 5, 0, 5, 0, 0);
Console.WriteLine(s.Area());
```
## Points
- Inherit the right class (In this case, Quadrilateral)
- 繼承類別需正確,答案也包括在內
- Mind your setter/getter
- setter/getter有無正確寫好寫對
- Write just one file.
- 不要寫成一堆檔案,只能有一個.cs檔
- Don't use Console.Readline() to input data
- 拜託不要寫Console.Readline()讓我們現場打資料
- If you have questions while doing Lab, you can ask your classmates first.
- Demo時程式有問題優先問同學,助教人力有限需同時demo,且隨著Lab答案越來越長,通靈難度隨之增加