/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication25;
/**
*
* @author ANGGA
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
// masukkan nilai x
System.out.println(fungsi(-2));
System.out.println(fungsi(4));
System.out.println(rata2(fungsi(-2),fungsi(4)));
System.out.println();
}
public static double fungsi(double x){
// disini untuk merubah fungsi
double hasil=Math.pow(x, 4)+3*Math.pow(x, 3)+6*Math.pow(x, 2)-7*x;
return hasil;
}
public static double rata2(double x, double y){
double rata2=(x+y)/2;
return rata2;
}
}