1个回答
2013-10-20
展开全部
public class Jifeng {
public Jifeng(int a,int b , int c,int l,int u){ h1 = a; h2 = b; h3 = c; lower = l; upper = u; } public double getResult(){ double result = 0 ; for(int i = 0 ; i < count ;i++){ double x = lower+(upper-lower)*i/((double)count); System.out.println(x); double fx = h1*x*x + h2*x + h3; System.out.println(fx); result+=fx/count; } return result; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Jifeng temp = new Jifeng(1,1,1,0,1); System.out.println(temp.getResult());; }
private int h1; private int h2; private int h3; private int lower; private int upper; private static int count = 10000;}
public Jifeng(int a,int b , int c,int l,int u){ h1 = a; h2 = b; h3 = c; lower = l; upper = u; } public double getResult(){ double result = 0 ; for(int i = 0 ; i < count ;i++){ double x = lower+(upper-lower)*i/((double)count); System.out.println(x); double fx = h1*x*x + h2*x + h3; System.out.println(fx); result+=fx/count; } return result; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Jifeng temp = new Jifeng(1,1,1,0,1); System.out.println(temp.getResult());; }
private int h1; private int h2; private int h3; private int lower; private int upper; private static int count = 10000;}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询