package abstractFactory.americanFleet;
import abstractFactory.Car;
public class Dodge
extends Car
implements Cloneable { private boolean diesel;
public Dodge
(String number,
int doorNum,
boolean diesel
) { super(number, doorNum, 4, 5, 180);
this.diesel = diesel;
}
public boolean isDiesel() {
return diesel;
}
//equals/hashCode/toString >>
public boolean equals
(Object o
) { if (!(o instanceof Car)) {
return false;
}
if (!(o instanceof Dodge)) {
return o.equals(this);
}
Dodge other = (Dodge) o;
return (super.equals(o) &&
other.diesel == diesel);
}
public int hashCode() {
int res = super.hashCode();
res = res * 37 + (diesel ? 1 : 0);
return res;
}
String res =
super.
toString();
res += ", diesel=" + diesel;
return res;
}
}