Facebook
From Anorexic Gorilla, 6 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 269
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package zadanie2;
  7. import java.util.Scanner;
  8.  
  9. /**
  10.  *
  11.  * @author Adam6560b
  12.  */
  13. public class Zadanie2 {
  14. static double a=0,b=0,c=0,d=0;
  15. static Scanner in= new Scanner(System.in);    
  16.  
  17. /**
  18.      *
  19.      * @param args the command line arguments
  20.      */
  21.     public static void main(String[] args) {
  22.    
  23.     double[] x = new double[3];
  24.     try{
  25.    
  26.        
  27.        
  28.         System.out.print("podaj a: ");
  29.         a=in.nextDouble();
  30.         System.out.print("podaj b: ");
  31.         b=in.nextDouble();
  32.         System.out.print("podaj c: ");
  33.         c=in.nextDouble();
  34.        
  35.        
  36.         System.out.println(Rkw.delta());
  37.        
  38.        
  39.     }catch(Exception ex){
  40.         System.out.println("Złe dane");
  41.     }finally{
  42.         System.out.println("koniec obliczen");
  43.     }
  44.        
  45.     }
  46.    
  47.    
  48.     public  double miejscazerowe(double d){
  49.     if(d>0){}
  50.     return d;
  51.     }
  52.  
  53.     public static class Rkw{
  54.    
  55.     public  static double delta()
  56.     {
  57.         d=Math.pow(b, 2)-4*a*c;
  58.         return d;  
  59.        
  60.     }
  61. }    
  62. }
  63.  
  64.  
  65.