62,614
社区成员
发帖
与我相关
我的任务
分享
public interface ItemIntf {
String getItemDescription();
void setItemDescription(String description);
float getItemPrice();
void setItemPrice(float price);
void setItemType(ItemType itemType);
boolean isItemImported();
boolean isItemExempted();
float getItemPriceWithTax();
float getItemSaleTax();
}
public class Item implements ItemIntf {
protected float itemPrice;
private String name;
private ItemType itemType;
}
public interface CartIntf {
public void addItemToCart(ItemIntf item); //为什么是接口,而不是类呢[
public void calculateAndPrintReceiptWithTax();
public float getTotalCost() ;
public float getSalesTax() ;
}
public class Cart implements CartIntf{
private List<ItemIntf> itemList; // 为什么是接口,而不是类呢?
private float saleTax;
private float totalCost;
private static final Format FORMATTER = new DecimalFormat("0.00");
}