diff --git a/Eingabe.java b/Eingabe.java index 0f5e95e..c7f24db 100644 --- a/Eingabe.java +++ b/Eingabe.java @@ -1,10 +1,5 @@ -/** - * Beschreiben Sie hier die Klasse Eingabe. - * - * @author (Ihr Name) - * @version (eine Versionsnummer oder ein Datum) - */ + import java.util.Scanner; public class Eingabe { diff --git a/Mitternachtsformelrechner.java b/Mitternachtsformelrechner.java new file mode 100644 index 0000000..12e24fd --- /dev/null +++ b/Mitternachtsformelrechner.java @@ -0,0 +1,49 @@ +import java.util.Scanner; + +public class Mitternachtsformelrechner +{ +public static void Mitternachtsformelrechner() + { +Scanner sc = new Scanner(System.in); +System.out.println("Erste Zahl eingebne:"); +double a = sc.nextInt(); + + System.out.println("Zweite Zahl eingebne:"); +double b = sc.nextInt(); + + System.out.println("Dritte Zahl eingebne:"); +double c = sc.nextInt(); + + double root; +root = Math.sqrt((b * b) - (4 * a * c)); + +double bottom; + bottom = (2 * a); + +double result1; +result1 = (-b + root) / bottom; +System.out.print("x1=:"); +System.out.println(result1); + + +double result2; +result2 = (-b - root) / bottom; +System.out.print("x2=:"); +System.out.println(result2); +if( root < 0) { + System.out.print("Ich rechne nicht gern Mitternachtsformel weils cool is sondern weil ich gerne Mitternachtsformel rechne basta abgesehn davon rechne ich keine Mitternachtsformel..."); +} +else{ + if( root == 0) { + System.out.print("x1=:"); +System.out.println(result1); + +System.out.print("x2=:"); +System.out.println(result2); + } +} +} +} + + +