0

**My assignment:** Write a program that extends the example that we have done in class. Create a class called Trapezium, which is determined by two parallel sides “a” and “b” and the height “h” between them.The area of the trapezium can be calculated as Area = (a+b)h/2

The perimeter = a + b + 2 sqrt[{h2 + (b-a)2/4}]

Add this class to your project and add a couple of them to your object array. Print the array of objects. Sort the array and print it again.

**My code so far:

```
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;
import java.util.Set;
import java.util.Map;
/**
* Write a description of class trap here.
*
* @author (your name)
* @version (a version number or a date)
*/
public abstract class Trapezium extends GeometricObject {
private double width;
private double height;
public Trapezium () {
}
private int base1, base2, side;
public Trapezium (int b1, int b2, int s)
{
base1 = b1;
base2 = b2;
side = s;
}
public int getBase1()
{
return base1;
}
public int getBase2()
{
return base2;
}
public int area()
{
int area = (((base1 + base2)*side)/2);
return (int) area;
}
public int perimeter()
{
int perimeter=((base1 + base2 + 2)) * (sqrt((side*side)+(base2 - base1 )(base2-base1))/4);
return perimeter;
}
public String toString()
{
return("b1=" + base1+ ", b2=" +base2+ ", side=" + side);
}
}
```

****(NOT COMPILING) **

Help I am beyond lost!