# Help with a PolyGrapher Program ASAP

• 06-14-2011, 10:40 PM
acole5
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:
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.
• 06-14-2011, 11:52 PM
Norm
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.
• 06-15-2011, 03:07 AM
acole5
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.
• 06-15-2011, 03:09 AM
Norm
Quote:

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

Quote:

I have no idea how to create the Polynomial class
What is that class supposed to do?
• 06-15-2011, 03:31 AM
acole5
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()
• 06-15-2011, 03:34 AM
Junky
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.
• 06-15-2011, 03:35 AM
Norm
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?