Advertisement
Guest User

beruhigdich

a guest
Oct 20th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. import java.lang.Math;
  2.  
  3. public class Mitternacht {
  4.  
  5.     public static void main(String[] args)
  6.  
  7.     {
  8.        
  9.         double a = 1;
  10.  
  11.         double b = 2;
  12.  
  13.         double c = 1;
  14.  
  15.         double p = b / a;
  16.  
  17.         double q = c / a;
  18.  
  19.         double disc = Math.pow(p/2,2) -q;
  20.  
  21.     if (disc > 0)
  22.  
  23.     {
  24.  
  25.     System.out.println("Das Ergebnis für x1 ist: " + ((-p/2) + Math.sqrt((disc)) ));
  26.  
  27.     System.out.println("Das Ergebnis für x2 ist: " + ((-p/2) - Math.sqrt((disc)) ));
  28.  
  29.     }
  30.  
  31.     else if ( disc < 0 )  
  32.  
  33.     {
  34.  
  35.     System.out.println("Kein Ergebnis");
  36.  
  37.     }
  38.  
  39.      else if ( disc == 0 )
  40.  
  41.     {
  42.  
  43.     System.out.println("Das Ergebnis x ist: " + (-p/2));
  44.  
  45.     }
  46.  
  47.     }
  48. }
  49.  
  50.  
  51.  
  52. public class Uhrzeit {
  53.  
  54.    
  55.     public static void main(String[]args){
  56.        
  57.         double std=1;
  58.         double min=36;
  59.         double sek=20;
  60.        
  61.          System.out.println("Seit Mitternacht sind es " +((std*60*60)+(min*60)+sek) + " Sekunden");
  62.          System.out.println("Die verbleibenden Sekunden vom Tag sind " +(86400 - ((std*60*60)+(min*60)+sek)));
  63.          System.out.printf ("Es sind bereits %,.5f %% des Tages vergangen \n", ((((std*60*60)+(min*60)+sek) / 86400) * 100));
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement