4th yr univ.student, elect.&computer eng'g dep't,
December 23, 2008 at 5:30 PM
THANK FOR REPLAYING YOU ARE DEPENDEBLE!!!
#2) Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Make the hierarchy as deep (i.e., as many levels) as possible. Specify the instance variables 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. Write a program that instantiates objects of your classes and outputs each object's area (except Quadrilateral). #3) (Complex Numbers) Create a class called Complex for performing arithmetic with complex numbers. Write a program to test your class. Use floating-point variables to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. Provide a no-argument constructor with default values in case no initializers are provided. Provide public methods that perform the following operations: a. Add two Complex numbers b. Subtract two Complex numbers c. Print Complex numbers in the form (a, b), where a is the real part and b is the Imaginary part