Hello,
I'm having a bit of trouble with this error. The error seems to be wih setRented but I'm not really sure what to change.
This is my interface

public interface Rentable{
    double getRent();
    void setRent (double rent);
    boolean isRented();
    void setRented (boolean rented);
}

This is my abstract class

public abstract class Vehicle{
    private String make;


    public Vehicle (String make){
        this.make=make;
    }
   public String getMake(){
    return make;
   }

   public abstract String getLicenceCat();

   public String toString(){
    return "Make" + make;
   }
   }

And this is my Concrete subclass

ublic class RentalCar extends Vehicle implements Rentable{
    private String licenceCat;
        private double rent;
    private boolean rented;

    public RentalCar (String make){
        super(make);
    }
    public String getLicenceCat(){
        return "Licence Category";
    }
    public void setRent (double rent){
        this.rent = rent;
        }
        public double getRent(){
            return rent;
        }
    public boolean isRented(){
        rented = true;
        return rented;
    }
    public void setRent (boolean rented){
        this.rented = rented;
    }
    }

Thanks!

It's a good idea to use an @Override annotation whenever overriding an inherited method or implementing an abstract one, eg

@Override
public void setRent (boolean rented){
  this.rented = rented;
}

This will immediatly generate a compiler error telling you exactly what you did wrong (and will be helpful for anyone reading the code).

Comments
+1 for Override
This article has been dead for over six months. Start a new discussion instead.