Results 1 to 7 of 7
  1. #1
    acole5 is offline Member
    Join Date
    Jun 2011
    Posts
    10
    Rep Power
    0

    Default 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. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default

    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. #3
    acole5 is offline Member
    Join Date
    Jun 2011
    Posts
    10
    Rep Power
    0

    Default

    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. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default

    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. #5
    acole5 is offline Member
    Join Date
    Jun 2011
    Posts
    10
    Rep Power
    0

    Default

    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. #6
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    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. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default

    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?

Similar Threads

  1. HELP with a plotter program ASAP!
    By acole5 in forum New To Java
    Replies: 3
    Last Post: 06-03-2011, 12:16 AM
  2. Please help me ASAP!
    By Asvin in forum New To Java
    Replies: 13
    Last Post: 05-17-2011, 05:55 PM
  3. Need help ASAP, please
    By KAM0002 in forum New To Java
    Replies: 6
    Last Post: 12-08-2010, 04:58 PM
  4. Assistance needed ASAP: Postpix program
    By Debonairj in forum New To Java
    Replies: 18
    Last Post: 07-27-2010, 01:37 PM
  5. Need help ASAP with Payroll Program Part 2
    By arrech326 in forum New To Java
    Replies: 10
    Last Post: 11-17-2009, 10:17 PM

Posting Permissions

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