01: /**
02:    A simple invoice formatter.
03: */
04: public class SimpleFormatter implements InvoiceFormatter
05: {
06:    public String formatHeader()
07:    {
08:       total = 0;
09:       return "     I N V O I C E\n\n\n";
10:    }
11: 
12:    public String formatLineItem(LineItem item)
13:    {
14:       total += item.getPrice();
15:       return item.toString() + ": $" 
16:          + item.getPrice() + "\n";
17:    }
18: 
19:    public String formatFooter()
20:    {
21:       return "\n\nTOTAL DUE: $" + total + "\n";
22:    }
23:    
24:    private double total;
25: }
26: