【发布时间】:2014-01-20 18:37:06
【问题描述】:
考虑一个 Quadratic 类,它维护有关二次表达式 ax^2+bx+c 的信息。
public class Quadratic
{
private double a;
private double b;
private double c;
/* Constructor: initializes all instance variables
*/
public Quadratic(double aVal, double bVal, double cVal)
{ //code omitted
}
/* This method determines and displays the real roots of
* the quadratic this.
*/
public void displayRoots()
{ //code omitted.
}
/* Returns the value of this quadratic evaluated at xVal.
*/
public double calcValue(double xVal)
{ //code omitted.
}
} //end class
所以问题问了: 完成构造函数 Quadratic,它将实例变量初始化为所提供参数的值。
public Quadratic (double aVal, double bVal, double cVal)
{
}
【问题讨论】:
-
你的问题是什么?还是您只是告诉我们该怎么做?
-
你的意思是:
// Please write code for me,而不是所有这些地方的// code omitted? -
@RohitJain 我想他刚刚把他的家庭作业贴在这里了。
-
你通常如何分配东西?
-
一点也不清楚用户在问什么。再清楚不过了。既然只提到了一个问题,那这个问题怎么可能是其他问题呢?