2.1.22事务排序测试用例。编写一个SortTransaction类,在静态方法main()中从标准输入读取一系列事务,将它们排序并在标准输出中打印结果(请见练习1.3.17)
解答:
public class SortTransactions
{
public static Transaction[] readTransactions()
{//请见练习1.3.17}
public static void main(String[] args)
{
Transaction[] transactions=readTransactions();
Shell.sort(transactions);
for (Transaction t:transactions)
StdOut.println(t);
}
}