Facebook
From cem arslan, 5 Years ago, written in Java.
This paste is a reply to java first lab from cem arslan - view diff
Embed
Download Paste or View Raw
Hits: 365
  1.   package ders;
  2. import java.lang.Math;
  3.  
  4. public class ders{
  5.        
  6.        
  7.  
  8. public static void main (String[] args) {
  9.        
  10.         equation eq1=new equation(5,4,3);
  11.         System.out.println(eq1.sol());
  12.          
  13.          
  14.  }
  15.  
  16. }
  17.  
  18.  class equation {
  19.        
  20.          private int a;
  21.          private int b;
  22.          private int c;
  23.          
  24.          public equation (int a,int b,int c) {
  25.                  this.a=a;
  26.                  this.b=b;
  27.                  this.c=c;
  28.                  
  29.          }
  30.          
  31.          public double sol() {
  32.                  double delta=0.0d;
  33.                  
  34.                  int i=2;
  35.                  
  36.                  
  37.                 delta = Math.pow(i,this.b)- 4*(this.a*this.c);
  38.                
  39.                 return delta;
  40.                  
  41.                  
  42.                  
  43.                  
  44.          }
  45.  
  46. }