如何为此代码开发驱动程序类?Array的驱动程序类
Array类:
import java.util.Scanner;
public class Array
{
Scanner sc = new Scanner(System.in);
private double[] array = new double[];
public void setArray(double[] arr)
{
//I must set a value for the array length. set by user.
//user must input data
}
public boolean isInIncreasingOrder()
{
//must test if input is in increasing order
}
public boolean isInDecreasingOrder()
{
//must test if input is in descending order
}
public double getTotal()
{
//must find the total of all input
//total +=total
}
public double getAverage()
{
//must calculate average
//average = total/array.length
}
}
我猜我问的是究竟是什么我打电话的DriverClass,如何做到这一点。
由于
“驱动程序”,你的意思是一个类可以调用Array中的各种方法来验证你的实现是否有效? –
是的,这就是我的意思 – lwillins