Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1.         double a,b,c,il,dis,d,x1,x2;
  2.         a=Double.parseDouble(t1.getText());
  3.         b=Double.parseDouble(t2.getText());
  4.         c=Double.parseDouble(t3.getText());
  5.         if (a==0)
  6.         {
  7.             if(b==0)
  8.             {
  9.                 if(c==0)
  10.                 {
  11.                 l1.setText("Alles gleich ");  
  12.                 }else
  13.                 {
  14.                  l1.setText("Es gibt keine Lösung");
  15.                 }
  16.             }else
  17.             {
  18.                 il=-c/-b;
  19.                 l1.setText("x= "+il);
  20.             }
  21.         }else
  22.         {
  23.          dis=(b*b)-(4*a*c);
  24.          if(dis>0)
  25.          {
  26.             d= Math.sqrt(dis);
  27.             x1=-(b-d)/(2*a);
  28.             x2=-(b+d)/(2*a);
  29.             l1.setText("x1 = "+x1+" x2 = "+x2);
  30.          }else
  31.          {
  32.             if(dis==0)
  33.             {
  34.                 il=-b/(2*a);
  35.              l1.setText("x = "+il);  
  36.             }else
  37.             {
  38.              l1.setText("Es gibt keine Lösung!");  
  39.             }
  40.          }
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement