import java.text.NumberFormat; class Factuurregel { int productnr, aantal; double eenheidsprijs, btw; String naam; Factuurregel(int nr, String nm, int aant, double pr, double btw) { productnr = nr; naam = new String(nm); aantal = aant; eenheidsprijs = pr; this.btw = btw; } } class Factuur { /* ... vul zelf in ... */ } class TestFactuur { public static void main(String[] args) { Factuur f = new Factuur("Mw. de Reuver"); Factuurregel r; r = new Factuurregel(227, "6 Appels Granny Smith", 1, 40, 6); f.nieuweRegel(r); r = new Factuurregel(12, "IOMega Zip Drive", 1, 5999, 19.5); f.nieuweRegel(r); NumberFormat df = NumberFormat.getInstance(); df.setMinimumFractionDigits(2); df.setMaximumFractionDigits(2); System.out.println("Totaal voor de twee producten:"); System.out.println( df.format(f.totaalExclusief()) + " BEF netto"); System.out.println( df.format(f.totaalInclusief()) + " BEF incl. BTW"); } }