parent
e4f460f7a1
commit
cdda2694c3
|
@ -1,10 +1,5 @@
|
||||||
|
|
||||||
/**
|
|
||||||
* Beschreiben Sie hier die Klasse Eingabe.
|
|
||||||
*
|
|
||||||
* @author (Ihr Name)
|
|
||||||
* @version (eine Versionsnummer oder ein Datum)
|
|
||||||
*/
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
public class Eingabe
|
public class Eingabe
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue