【发布时间】:2015-04-12 05:53:37
【问题描述】:
我将如何为我编写的这段代码开发驱动程序类?
数组类:
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 中的各种方法,以验证您的实现是否有效?
-
是的,这就是我的意思