**THIS IS AN IN CLASS EXCERCISE AND WILL NOT DIRECTLY AFFECT YOUR GRADE**

* Your solutions will be evaluated by the TAs to judge your knowledge of the material so please write neatly and keep your solution organized.

Problem 1: Create the classes Car, ParkingGarage, Truck, and Vehicle. Car and Truck will both be subclasses of Vehicle (They are specific types of vehicles). The classes will have each of the attributes and methods that follows below. Then create the UML diagram for each class and their relationships. Finally, create a driver which will test the usage of these classes.

The Car class will contain:

Attributes

  numberOfPassengers - type int, private

Methods

  There are no methods in addition to the list we have discussed in lecture which must be included
  in every class.


The ParkingGarage class will contain:

Attributes

  spaces[] - type Vehicle, public
  spacesFilled - type int, private

Methods

  public int findVehicle(Vehicle vehicle) - Searches through all the spaces for the vehicle
  that matches the object given.  Note you should not search for an object match (ie the same
  reference) instead search for a vehicle that has the exact same representation
  (attributes).  Return the space number where the vehicle is located or -1 if the vehicle
  could not be found.

  public boolean parkVehicle(Vehicle vehicle) - Allows a vehicle to be parked in an
  open space. Returns true if a space is available, false if one is not.  

  In addition, create the other methods we have discussed in lecture which must be included
  in every class.


The Truck class will contain:

Attributes

  weightCapacity - type double, private

Methods

  There are no methods in addition to the list we have discussed in lecture which must be included
  in every class.


The Vehicle class will contain:

Attributes

  mileage - type int, protected
  milesPerGallon - type double, protected
  color - type String, protected

Methods

  There are no methods in addition to the list we have discussed in lecture which must be included
  in every class.