Inheritance Exercises

Q1. In the following pairs of classes, identify the superclass and the 
    subclass:
* Employee, Manager
* Polygon, Triangle
* GraduateStudent, Student
* Person, Student
* Employee, GraduateStudent
* BankAccount, CheckingAccount
* Vehicle, Car
* Vehicle, Minivan
* Car, Minivan
* Truck, Vehicle


Q2. Draw an inheritance diagram that shows the inheritance relationships
    between the classes
* Person
* Employee
* Student
* Instructor
* Classroom
* Object


Q3. In an object-oriented traffic simulation system, we have the following
    classes. Draw an inheritance diagram that shows the relationships between
    these classes
* Vehicle
* Car
* Truck
* Sedan
* Coupe
* PickupTruck
* SportUtilityVehicle
* Minivan
* Bicycle
* Motorcycle


Q4. What inheritance relationships would you establish among the following classes:
* Student
* Professor
* TeachingAssistant
* Employee
* Secretary
* DepartmentChair
* Janitor
* SeminarSpeaker
* Person
* Course
* Seminar
* Lecture
* ComputerLab


Q5. Suppose the class Sub extends the class Sandwich. Which of the following
    assignments are legal?

Sandwich x = new Sandwich ();

Sub y = new Sub();

x = y;

y = x;

y = new Sandwich();

x = new Sub();