Your code doesn't make any sense:
public void setShip(int ship){
super.computePrice() + ship;
}
super.computePrice()
is a function that either returns something or returns void
. You are adding an int
to it but you aren't doing anything with it. Assume this function returns 100.0
. Then it's equivalent to the line 100.0 + 15;
This is not a statement in Java.
I'm assuming you want a ShippedOrder
to increase the price of an Order
by the value ship
. If so, I'd suggest removing the setShip
function and just pass unitPrice + ship
when you call the Order's constructor as so:
public ShippedOrder(String cusName, int cusNo, int qty, double unitPrice, int ship){
super(cusName, cusNo, qty, unitPrice+ship);
}
If you don't want to do this, consider keeping a value shipPrice
in ShippedOrder
and set it in the constructor.
public ShippedOrder(String cusName, int cusNo, int qty, double unitPrice, int ship){
super(cusName, cusNo, qty, unitPrice);
this.shipPrice = ship;
}