title: Java abstract classes and inheritance
body: <p>Can someone please take a look at my code and suggest where I wandered off the path of working code.</p>
  
  <p>The assignment reads:
  Write an application named UseLoan that uses an abstract class named PersonalLoan and subclasses to display two different types of loans -home and car- and the cost per month for each. Each of the subclasses contains a constructor that sets the cost per month based on the loan type, after prompting the user for at least one data-entry item that is used in the cost-determining decision. (For example, with a car loan, you might ask the age of the car, or whether it is a sports car.) Include an abstract toString() method in the PersonalLoan class that constructs a String containing all the relevant data. Prompt the user for the type of insurance, and then create and display the appropriate object. Save the files as PersonalLoan.java, CarLoan.java, homeLoan.java, and UseLoan.java.</p>
  
  <p>when i compile code i get following error</p>
  
  <p>Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
      Cannot instantiate the type CarLoan
      Cannot instantiate the type CarLoan
      Cannot instantiate the type CarLoan
      Cannot instantiate the type CarLoan
      Cannot instantiate the type HomeLoan</p>
  
  <pre><code>at UseLoan.main(UseLoan.java:7)
  </code></pre>
  
  <p>My code so far is as follows:</p>
  
  <pre><code>public abstract class PersonalLoan {
  
  String title = new String();
  double sportsPrice, suvPrice, hybridPrice, pickupPrice, price30, price15, price5;
  
  public PersonalLoan(String t) {
      title = t;
  }
  
  public String getTitle() {
      return title;
  }
  
  public double getSportsPrice() {
      return sportsPrice;
  }
  
  public abstract void setSportsPrice();
  
  public double getSUVPrice() {
      return suvPrice;
  }
  
  public abstract void setSUVPrice();
  
  public double getHybridPrice() {
      return hybridPrice;
  }
  
  public abstract void setHybridPrice();
  
  public double getPickupPrice() {
      return pickupPrice;
  }
  
  public abstract void setPickupPrice();
  
  public double getPrice30() {
      return price30;
  }
  
  public abstract void setPrice30();
  
  public double getPrice15() {
      return price15;
  }
  
  public abstract void setPrice15();
  
  public double getPrice5() {
      return price5;
  }
  
  public abstract void setPrice5();
  }
  </code></pre>
  
  <p>here is second subclass PersonalLoan:</p>
  
  <pre><code>public class CarLoan extends PersonalLoan {
  
  public CarLoan(String title) {
      super(title);
      setSportsPrice();
      setSUVPrice();
      setHybridPrice();
      setPickupPrice();
  }
   public void setSportsPrice() {
      super.sportsPrice = 1.99;
   }
  
  public void setSUVPrice() {
      super.suvPrice = 2.99;
  }
  
  public void setHybridPrice() {
      super.hybridPrice = 3.99;
  }
  
  public void setPickupPrice() {
      super.pickupPrice = 4.99;
  }
  }
  </code></pre>
  
  <p>here is class HomeLoan:</p>
  
  <pre><code>public class HomeLoan extends PersonalLoan {
  
  public HomeLoan(String title) {
      super(title);
      setPrice30();
      setPrice15();
      setPrice5();
  }
  
  public void setPrice30() {
      super.price30 = 1.99;
  }
  
  public void setPrice15() {
      super.price15 = 2.99;
  }
  
  public void setPrice5() {
      super.price5 = 3.99;
  }
  }
  </code></pre>
  
  <p>Here is main class UseLoan:</p>
  
  <pre><code>public class UseLoan {
  
   public static void main(String[] args) {
      PersonalLoan aPersonalLoan[] = new PersonalLoan[5];
      int x;
      aPersonalLoan[0] = new CarLoan("Sports Car");
      aPersonalLoan[1] = new CarLoan("SUV");
      aPersonalLoan[2] = new CarLoan("Hybrid");
      aPersonalLoan[3] = new CarLoan("Pickup Truck");
      aPersonalLoan[5] = new HomeLoan("30 Year Mortgage");
  
      for (x = 0; x &lt; aPersonalLoan.length; ++x) {
          System.out.println("Book #" + (x + 1) + ": " + aPersonalLoan[x].getTitle() + " costs $" + aPersonalLoan[x].getSportsPrice());
          //System.out.println("Book #" + (x + 1) + ": " + aPersonalLoan[x].getTitle() + " costs $" + aPersonalLoan[x].getSUVPrice());
          //System.out.println("Book #" + (x + 1) + ": " + aPersonalLoan[x].getTitle() + " costs $" + aPersonalLoan[x].getHybridPrice());
          //System.out.println("Book #" + (x + 1) + ": " + aPersonalLoan[x].getTitle() + " costs $" + aPersonalLoan[x].getPickupPrice());
          //System.out.println("Book #" + (x + 1) + ": " + aPersonalLoan[x].getTitle() + " costs $" + aPersonalLoan[X].getPrice30());
          //System.out.println("Book #" + (x + 1) + ": " + aPersonalLoan[x].getTitle() + " costs $" + aPersonalLoan[X].getPrice15());
          //System.out.println("Book #" + (x + 1) + ": " + aPersonalLoan[x].getTitle() +          " costs $" + aPersonalLoan[X].getPrice5());
      }
  }
  }
  </code></pre>