Question
Need help with Java coding for a class with mathematical functions: Complete the implementation of the following class. This class will model a class variable
Need help with Java coding for a class with mathematical functions:
Complete the implementation of the following class. This class will model a class variable to hold a mathematical function of up to 10 terms. The function will have one independent variable.
Terms that the function will model are:
-Monomials of the form: 5.3x^0.5
-Trigonometric terms sin(x), cos(x), tan(x) of the form: 1.2cos(3.0x)
public class Function { // PLEASE leave your class name as Function
// CLASS VARIABLES
// use any collection of variables as you see fit.
// CONSTRUCTORS
Intialize Function to f(x)=0
public Function() {
}
// Set Function to f(x)=c
public Function(double c) {
}
// Set Function to f(x)=bx+c
public Function(double b, double c) {
}
// Set Function to f(x)=ax^2+bx+c
public Function(double a, double b, double c) {
}
// Set Function to f(x)=coeff*trigFunction(px)
// - angle in radians
// allow trigFunction to be "sin", "cos" or "tan"; set f(x)=0 for
unknown trigFunctions.
public Function(double coeff, String trigFunction, double p) {
}
// Add a polynomial term of the form: Cx^P. to the Function
public void addTerm(double C, double P) {
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started