公共類庫存擴展項目實現可比<。股票& gt{
私有字符串位置;
私有int數量;
公共庫存(字符串商品,整數單位盒,字符串位置,整數數量){
super(商品,unitperbox);
this.location = location
this.qty = qty
}
公共國際比較(股票a){
if(a . ShowUnitPerBox()* a . show qty()= = super。ShowUnitPerBox()*this。ShowQty()){
返回0;
} else if(a . ShowUnitPerBox()* a . show qty()& lt;超級棒。ShowUnitPerBox()*this。ShowQty()){
返回1;
}否則{
return-1;
}
}
公共字符串ShowLocation(){
返回this.location
}
public int ShowQty(){
返回this.qty
}
public int Total(){
返回超級。ShowUnitPerBox()*this。show qty();
}
}