All vehicles used for transportation in the U.S. must have identification, which varies according to the type of vehicle. For example, all automobiles have a unique Vehicle Identification Number (VIN) assigned by the manufacturer, plus a license plate number assigend by the state in which the auto is registerd.

Modify the Auto class to include an instance variable for the license plate number. Implement the constructor so that an Auto can be constructed with a VIN and a license plate number.

Override the getID() method to return the id of the auto as shown in this format: VIN=1234567890,plate=ABC123 (without any spaces).

Complete the following file:

Auto.java

/** Represents an automobile. */ public class Auto // TODO: Inherit from Vehicle { // TODO: Declare instance variables public Auto(String vin, String plate) { // TODO: Complete the constructor } // TODO: implement the getID() method for autos }

Use the following files:

Vehicle.java

/**
   Represents a vehicle of any type.
*/

public class Vehicle
{
   private String id;
   private double mileage;

   public Vehicle(String anId)
   {
      id = anId;
      mileage = 0;
   }

   public void move(double milesMoved)
   {
      mileage = mileage + milesMoved;
   }

   public String getID()
   {
      return id;
   }
   
   public double getMileage()
   {
      return mileage;
   }
}

VehicleTester.java

public class VehicleTester
{
   public static void main(String[] args)
   {
      Vehicle myVehicle = new Auto("0149162536496481100", "5ZSN090");
      myVehicle.move(1000);
      myVehicle.move(2000);
      System.out.println(myVehicle.getID());
      System.out.println("Expected: VIN=0149162536496481100,plate=5ZSN090");
      System.out.println(myVehicle.getMileage());
      System.out.println("Expected: 3000.0");
   }        
}