Facebook
From Paltry Lion, 6 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 281
  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.  
  15.     /**
  16.      * @param args the command line arguments
  17.      */
  18.     public static void main(String[] args) {
  19.     double a=0,b=0,c=0,d=0;
  20.     double[] x = new double[3];
  21.     try{
  22.    
  23.         Scanner in= new Scanner(System.in);
  24.        
  25.         System.out.print("podaj a: ");
  26.         a=in.nextDouble();
  27.         System.out.print("podaj b: ");
  28.         b=in.nextDouble();
  29.         System.out.print("podaj c: ");
  30.         c=in.nextDouble();
  31.        
  32.        
  33.         System.out.println(Rkw.delta(a,b,c,d));
  34.        
  35.     }catch(Exception ex){
  36.         System.out.println("Złe dane");
  37.     }finally{
  38.         System.out.println("koniec obliczen");
  39.     }
  40.        
  41.     }
  42.    
  43.    
  44.     public  double miejscazerowe(double d){
  45.     if(d>0){}
  46.     return d;
  47.     };
  48.  
  49.     class Rkw{
  50.    
  51.     public  double delta(double a, double b, double c, double d)
  52.     {
  53.         d=Math.pow(b, 2)-4*a*c;
  54.         return d;  
  55.        
  56.     };
  57. }    
  58. }
  59.  
  60.  
  61.