/** This class is Sum Functions for * sum of two real functions * such as f1(x) + f2(x) */ import java.util.*; public class SumFunctions implements RealFunction { /** This constructor sum two functions * and save them * @param f1 & f2 are two * objects of Real Functions */ public SumFunctions ( RealFunction f1 , RealFunction f2 ) { RealFunction f3 = new SumFunctions(f1 , f2); String sum = "f3" +" = " + f1 + "+" + f2; } /** This method for sum two * real functions * @param * @return */ public double valueAt(double x) { //double sum = 0.0; return SumFinction(f1 , f2); } } /*********************************************************************/ /** This interface RealFunction for * define some simple * mathematical functions */ public interface RealFunction { /** This method for make * functionthat take value and return it * after make calculate in this function * @param x is variable in function * @return the value after calculation * in function*/ public double valueAt(double x); }

i have error in cannot find symbol

symbol : variable f1

cannot find symbol

symbol : variable f2

location: class SumFunctions

i want to make code such as example but make error

RealFucntion f1 = new QuadraticFunction(1); // a = 1

RealFunction f2 = new CosineFunction();

RealFunction f3 = new LinearFunction(2, -1);// a = 2, b = -1

RealFunction g = new SumFunctions(f1,new

SumFunctions(f2,f3));

// Now print the value of the function g(x)

// g(x) = f1(x) + f2(x) + f3(x) = x^2 + 2x - 1 + cos(x)

// for x = 1.2

System.out.println(g.valueAt(1.2));