Configured as a simple program P (comprising two Faults: F1 and F2), while constructing t1, t2 and t3, such that
- t1 performed separately and found to F1 Failure;
- t2 performed separately and found Failure to F2;
- t3 simultaneously performed to F1 and F2, and can produce Error of F1, but no Failure. // please indicate the detailed notes
public class Test {
public static void P(int [] numbers){
int lenth = numbers.length;
double mean,sum;
sum = 0.0;
if (lenth > 2 )
{
for (int i = 1; i < lenth; i++) {
sum += numbers[i];
}
mean = sum / (double) lenth;
System.out.println("Mean:" + mean);
}
if (lenth <= 4 )
{
int max = numbers[0];
for (int i = 1; i < lenth; i++) {
if (numbers[i] < max)
{
max = numbers[i];
}
}
System.out.println("Max:" + max );
}
}
public static void main(String[] args) {
int t1[] = {2, 3, 5, 6, 9};
int t2[] = {5, 6};
int t3[] = {0, 5, 4};
System.out.print("t1期待输出:Mean:5,实际输出:");
P(t1);
System.out.println("----------------------------------");
System.out.print("t2期待输出:Max:6,实际输出:");
P(t2);
System.out.println("----------------------------------");
System.out.print("t3期待输出:\n" + "Mean:3.0" + "\n" + "Max:5\n" + "实际输出:\n");
P(t3);
System.out.println("----------------------------------");
}
}