Answer:
The function in Java:
public static void displayResult(int outcomes[], int n){
System.out.println("Occurrence\tEstimated Probability");
for(int x : outcomes){
double prob = x/(double)n;
prob = Math.round(prob * 100000.0) / 100000.0;
System.out.println(x+"\t\t"+prob);
}
}
Step-by-step explanation:
See attachment 1 for complete question
This defines the function
public static void displayResult(int outcomes[], int n){
This prints the header
System.out.println("Occurrence\tEstimated Probability");
This iterates through the outcomes
for(int x : outcomes){
This calculates the probability
double prob = x/(double)n;
The probability is then rounded to 5 decimal places
prob = Math.round(prob * 100000.0) / 100000.0;
This prints each occurrence and the estimated probability
System.out.println(x+"\t\t"+prob);
}
}
See attachment 2 for complete program which includes the main