首页 > > 详细

讲解java Term 编程、java polynomial 数据库调试、辅导java程序、java程序辅导留学生

/**
* Term models terms in a polynomial.
*
* @author Lyndon While
* @version 1.0
*/
public class Term
{
// the term = coefficient * x ^ exponent
private double coefficient;
private int exponent;
public Term(double c, int e)
{
coefficient = c;
exponent = e;
}

// returns the coefficient
public double getCoefficient()
{
return coefficient;
}

// returns the exponent
public int getExponent()
{
return exponent;
}
// returns the term as a simple String for display
// e.g. with coefficient = 2 and exponent = 1, return "+ 2.0 x^1"
public String displaySimple()
{
// TODO
String displaySimple = "+ c*x^e";

return displaySimple;

}
// returns the term as a String for display:
// see the sample file and the test program for the layout required
public String displayImproved()
{
// TODO
if (coefficient 0){

}
if (exponent > 0){
}
return displayImproved;
}
}
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!