Complete the Car class below so that it inherits from the given Vehicle class. Cars lose value over time. In this example, you should assume that the value is reduced by 25 cents per mile driven, until it reaches zero.

Do not add any instance variables to the Car class.

Complete the following file:

Car.java

/** Represents a car. */ public class Car // TODO: Inherit from Vehicle { // Do NOT add any instance variables public Car(double purchasePrice) { // TODO: Complete } // TODO: Override the getValue method }

Use the following files:

CarTester.java

public class CarTester
{
   public static void main(String[] args)
   {
      Vehicle myCar = new Car(20000);
      System.out.println(myCar.getValue());
      System.out.println("Expected: 20000.0");
      myCar.move(10000);
      System.out.println(myCar.getValue());
      System.out.println("Expected: 17500.0");
      myCar.move(30000);
      System.out.println(myCar.getValue());
      System.out.println("Expected: 10000.0");
      myCar.move(40000);
      System.out.println(myCar.getValue());
      System.out.println("Expected: 0.0");
      myCar.move(10000);
      System.out.println(myCar.getValue());
      System.out.println("Expected: 0.0");
   }
}

Vehicle.java

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

public class Vehicle
{
   private double value;
   private double mileage;

   public Vehicle(double aValue)
   {
      value = aValue;
      mileage = 0;
   }

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

   public double getValue()
   {
      return value;
   }
   
   public double getMileage()
   {
      return mileage;
   }
}