This code fails to compile with the errors that follow, please help me correct the errors. This program has 3 other classes, let me know if I need to also send those. Thanks.
me correct the errors. This program has 3 other classes, let me know if I need to also send those. Thanks.
public class Hybrid extends Automobile{
private Integer mpg;
public Hybrid(String makeAndModel, Double purchasePrice, Integer mpg) {
super(makeAndModel, purchasePrice);
this.mpg = mpg;
}
@Override
public Double salesTax() {
Double salesTaxPrice = super.salesTax();
if(mpg < 40) {
if(salesTaxPrice – 100 >=0) {
return salesTaxPrice – 100;
}else {
return 0.0;
}
}else {
Integer discount = (this.mpg – 40) * 2;
if(salesTaxPrice – discount-100 >= 0) {
return salesTaxPrice – discount -100;
}else {
return 0.0;
}
}
}
public Integer getMpg() {
return mpg;
}
public void setMpg(Integer mpg) {
this.mpg = mpg;
}
@Override
public String toString() {
return String.format(“\nMake and Model : %s\n”
+ “Sales Price : %.2f\n”
+ “Sales Tax : %.2f\n”
+ “Hybrid Vehicle”
+ “MPG : %d\n”
,this.getMakeAndModel(),this.getPurchasePrice(),this.salesTax()
,this.getMpg());
}
}
Hybrid.java:17: error: constructor Automobile in class Automobile cannot be applied to given types;
super(makeAndModel, purchasePrice);
^
required: no arguments
found: String,Double
reason: actual and formal argument lists differ in length
Hybrid.java:23: error: method does not override or implement a method from a s..;@Override
^
Hybrid.java:29: error: cannot find symbol
Double salesTaxPrice = super.salesTax();
^
symbol: method salesTax()
Hybrid.java:93: error: cannot find symbol
,this.getMakeAndModel(),this.getPurchasePrice(),this.salesTax()
^
symbol: method getMakeAndModel()
Hybrid.java:93: error: cannot find symbol
,this.getMakeAndModel(),this.getPurchasePrice(),this.salesTax()
^
symbol: method getPurchasePrice()
5 errors