发票系统:
发票头部:header:顾客的名字,销售日期
发票主部:销售的货物清单,包括商品名字、购买数量、单价、小计
发票尾部;商品总金额
private static Order order;
public static void main(String[] args){
order = new SalesOrder();
order.setSalesdate(new Date());
order.setCustomerName("XYZ Repair Shop");
OrderLine line1 = new OrderLine();
line1.setItemName("Fire Wheel Tire");
line1.setUnitPrice(154.23);
line1.setUnits(4);
order.addItem(line1);
OrderLine line2 = new OrderLine();
line2.setItemName("Front Fender");
line2.setUnitPrice(300.43);
line2.setUnits(1);
order.addItem(line2);
order = new HeaderDecorator(
new FooterDecorator(order));
order.print();
}
}