1public
2class ComposeFunctions
3 implements RealFunction
4{
5 private
6 RealFunction f1;
7
8 private
9 RealFunction f2;
10
11 public
12 ComposeFunctions(RealFunction f1, RealFunction f2) {
13 this.f1 = f1;
14 this.f2 = f2;
15 }
16
17 public
18 double at(double x) {
19 return
20 f2.at(f1.at(x));
21 }
22
23 public
24 String toString() {
25 return
26 "(" + f1.toString() + " o " + f2.toString() + ")";
27 }
28}
29