import java.util.Arrays;
import java.util.List;
interface CalculationInt {
public int calculate(List<Person> persons);
}
interface CalculationDouble {
public double calculate(List<Person> persons);
}
class Person {
private String name;
private int age;
public String getName() { return name; }
public int getAge() {return age;}
Person(String name, int age) {
this.name=name; this.age=age;
}
}
public class Main {
public static void main(String []args) {
List<Person> personList = Arrays.asList(
new Person[]{
new Person("Oliver", 27),
new Person("James", 23),
new Person("Jack", 17),
new Person("John", 27),
new Person("Harry", 16),
new Person("Robert", 18),
new Person("Jacob", 38),
new Person("Micheal", 42),
new Person("Frank", 19),
new Person("Charlie", 11),
});
Statistic s = new Statistic();
System.out.println("Result: "+s.calculate(personList));
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: