public class U2A2 { // Achtung: In der Aufgabe ist zunächst NUR nach // der Polynomfunktion gefragt! static double P(double[] a, double x){ double ergebnis = 0.0; for(int i=0; i < a.length; i++){ ergebnis += a[i] * Math.pow(x, i); } return ergebnis; } // Hier ist die Lösung zu Ende! // NIcht gefragt, aber nützlich: Testfunktion public static void main(String[] args) { double[] koeff = { 1, -10, 5, -3.456 }; double stelle = 42.0; System.out.println("P(a,x) = " + P(koeff, stelle) ); } }