# Thread: Help with a PolyGrapher Program ASAP

1. Member
Join Date
Jun 2011
Posts
10
Rep Power
0

## Help with a PolyGrapher Program ASAP

Hey everyone, I'm relatively new to Java and I desperately need help with a project. I'm not asking anyone to do it for me, just some direction would be helpful. Here's the assignment (there are a lot of directions): Assignment

This is what I have so far for the Polygrapher class:
Java Code:
```import algoritharium.*;
import java.util.Scanner;

public class PolyGrapher {
double q,w,e,rangeA,rangeB,x;
public void plot() {
Scanner in = new Scanner(System.in);
System.out.println("Coefficient for x^3? ");
q=in.nextInt();
System.out.println("Coefficient for x^2? ");
w=in.nextInt();
System.out.println("Coefficient for x? ");
e=in.nextInt();
System.out.println(q+"x^3"+w+"x^2"+e+"x");
System.out.println("What is min of the range? ");
rangeA=in.nextInt();
System.out.println("What is max of the range? ");
rangeB=in.nextInt();
}
public double[] getGraphData (Polynomial p, double a, double b, int nPoints)	{
p=q*(x*x*x)+w*(x*x)+e*x;
int max, min, sf;
x=rangeA;
max=p;
x=rangeB;
min=p;
sf=graphHeight/( max - min );
System.out.print("yMin: "+min+" yMax: "+max+" sf: "+sf);
}
public void plotAndDifferentiate() {
plot();
differentiate(p);
graph(p);
}

}```
To be honest, I'm just really lost...I don't know if I'm misunderstanding the instructions or what but any help would be greatly appreciated! Thank you.

2. What is your problem? Go through your assignment and copy out the parts one by one that you are having a problem with. Paste them here and explain what your problem with that part.

3. Member
Join Date
Jun 2011
Posts
10
Rep Power
0
I guess to start I have no idea how to create the Polynomial class. I'm sort of understanding the PolyGrapher class now but I keep getting errors because I need to write the Polynomial class for the program to work.

4. I keep getting errors
please copy and paste the full text of the error messages here.

I have no idea how to create the Polynomial class
What is that class supposed to do?

5. Member
Join Date
Jun 2011
Posts
10
Rep Power
0
It's supposed to model a polynomial and contain these methods:

public Polynomial(double [] coefficients)
public double evaluate(double x)
public Polynomial differentiate()
public String toString()

6. So write the Polynomial class. Do it one method at a time and test that method works beofre moving onto the next. The toString method should be easiest so start there. As for the others, perhaps your assignment provides details of what they should do. If not I'm sure a Google search should provide info.

7. Ok, You know how to create a class that has methods. You've done it in the PolyGrapher class.
What is your problem with this class?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•