CS计算机代考程序代写 public class TestPair {

public class TestPair {

private static void test(Pair p) {

int val1, val2;

val1 = 10;
val2 = 20;

p.setFirst(val1);

if (p.getFirst() != val1) {
System.err.println(“test 1: failed, expected value “+val1+”, found ” + p.getFirst());
} else {
System.out.println(“test 1: passed”);
}

p.setSecond(val2);

if (p.getSecond() != val2) {
System.err.println(“test 2: failed, expected value “+val2+”, found ” + p.getSecond());
} else {
System.out.println(“test 2: passed”);
}

}

public static void main(String[] args) {

test(new PairVar(0, 0));

test(new PairArray(0, 0));

}

}