aspose file tools*
The moose likes Java in General and the fly likes Applet - Graphing Quadratic Function Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Applet - Graphing Quadratic Function Help" Watch "Applet - Graphing Quadratic Function Help" New topic
Author

Applet - Graphing Quadratic Function Help

Josh Crawford
Greenhorn

Joined: Jun 07, 2006
Posts: 11
Hi!

Im making an applet to graph a quadratic function...now im not going to be rude and say "tell me how to do it!" but i was just wondering if i could get some assistance on making it...

Now of course, i've had a go at it, and i've made an applet to display the z intercepts, y intercept, and vertex (turning point). This is determined by the user inputs of the three coefficients a, b, and c.

First question, is this all the information i will need?

Secondly, i am struggling to figure out how to put this information into a graph and make it a parabola...

Thank you very much for your help!

Ps. my applet is below if you wish to have a look, i've made a crude graph if that helps as well...





-Crawf
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39832
    
  28
Morning.

You are trying to do two things at the same time; shouldnt' these be in different classes?

You seem to have the method for solving a quadratic equation worked out, also drawing a graph on screen.

As for finding curves, have you explored the java.awt.geom package in the API yet? You might find something to your advantage there.

CR
Josh Crawford
Greenhorn

Joined: Jun 07, 2006
Posts: 11
Yeah, they probably should be in two different classes, but im doing this for a school assignment, and the teacher isnt expecting anything brilliant, he wants it VERY simple, but it would make things easier that way hey?

I've explored the java.awt.geom package, but found nothing as to what i am trying to achieve unfortunately...is there another way to plot each point onto the graph and and draw lines from each point. wouldnt that be easier? maybe...

Thanks!

-Crawf
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39832
    
  28
When I was a beginner in my first Java course, we were expected to have the correct number of classes from the very beginning. But now you have got this far without dividing into separate classes, finish it this time, and use more classes for your next exercise.

I've explored the java.awt.geom package
And you didn't find the QuadCurve2D classes?
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Originally posted by Campbell Ritchie:
When I was a beginner in my first Java course, we were expected to have the correct number of classes from the very beginning.


Young folks today....

Originally posted by Campbell Ritchie:
And you didn't find the QuadCurve2D classes?


It's not quite that easy -- QuadCurve2D is a quadratic parametric curve, not just a simple quadratic function. The OP would have to think a bit about tangent lines to calculate the control point...
[ June 08, 2006: Message edited by: Jeff Albertson ]

There is no emoticon for what I am feeling!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39832
    
  28
Sorry.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Originally posted by Campbell Ritchie:
Sorry.


Maybe it's a good idea to think about tangents
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39832
    
  28
from Jeff Albertson. Maybe it's a good idea to think about tangents
Agree.


Better than my flying off at a tangent.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Applet - Graphing Quadratic Function Help