package klasse5; import java.text.*; // importiert alle Klassen des packages java.text class Funktion extends basic{ public static void main(String[] args) { double x,y; NumberFormat f=new DecimalFormat("###,##0.00"); // Formatierung: mind. eine Stelle vor dem Komma, genau 2 Nachkommastellen out.writeln("Dieses Programm berechnet Funktionswerte von y=x²-3"); out.writeln(); x=-2.0; // Initialisierung der Zählvariable while (x<=2.01) { // Abbruchbedingung y=Math.pow(x,2.0)-3.0; // Berechnung des y-Wertes out.writeln(f.format(x)+"/"+f.format(y)); // formatierte Ausgabe x=x+0.1; // Hochzählanweisung } // Ende While-Schleife } }