1
2
3
4
5
6
7
8
9public
10class ScaleFunction
11 implements RealFunction
12{
13 private
14 double c;
15
16 private
17 RealFunction f;
18
19 public
20 ScaleFunction(double c, RealFunction f) {
21 this.c = c;
22 this.f = f;
23 }
24
25 public
26 double at(double x) {
27 return
28 c * f.at(x);
29 }
30
31 public
32 String toString() {
33 return
34 "" + c + "*" + f.toString();
35 }
36}
37
38