package com.company.mathe; public class pqFormelRechner { public static String berechnePQFormel(double P, double Q){ double eingabe = (P/2) * (P/2) - Q; if (eingabe >= 0) { double x1,x2; x1 = -(P/2) + Math.sqrt(eingabe); x2 = -(P/2) - Math.sqrt(eingabe); if (x1==x2){ return "Das Ergebnis ist L={"+x2+"}"; } else { return "Die Ergebnisse sind L={"+x1+";"+x2+"}"; } } else { return "Keine Lösung, das Ergebniss ist "+eingabe; } } }