Please help if anyone can!!!

I have multiple issues. first, i have a problem on iteration. i am given
(x,f(x)) and (x + d, f( x + d)), where x ranges from Xmin to Xmax and d = (Xmax - Xmin)/100. Draw the curve f(x) = X^3/100 - x + 10, where x ranges from -10 to 10 in this fashion. And am asked to draw a hundred line segments joining those points.
I have already figured that the distance d = 10-(-10)/100 which is equal to 0.2. Since i am told to draw 100 line segments, i figured that increasing -10 by .2 will take 100 iterations to get to 10.
Now my question is how do i use a "for" loop to represent the above statement. I have tried couple of them, but it doesn't seem right. example of the one i tried is:
let x = 10
for(i = -10; i < x; i++). I know this is wrong. Please help if anyone can. I will really appreciate and thanks in advance.

import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
This program draws graphs of curves using iterations
CS 46A, Fall, 2002
@author Afam Okeke Section 7
@version October 6, 2002 Program 6
public class DrawCubicApplet extends Applet
public void paint (Graphics g);
Graphics2D g2 = (Graphics2D)g;
double xscale = (getWidth() - 1.0) / (XMAX - XMIN);
double yscale = (getHeight() - 1.0)/ (YMIN - YMAX);
g2.scale (xscale, yscale);
g2.translate (-XMIN, -YMIN);
g2.setStroke (new BasicStroke(0));
final double Xmax = 10;
final double Xmin = -10;
final double Ymax = 15;
final double Ymin = 5;
double d = 0.2;
This is how far i have gotten. Now i don't know how to set up my 'for' loop for the x values. That is, how can i state that from -10 with an increment of 0.2 will take 100 iterations to get to 10. I hope am not confusing you. Below is the question
Question: Simply draw a hundred line segments joining the points (x,f(x)) and (x + d, f( x + d)), where x ranges from Xmin to Xmax and d = (Xmax - Xmin)/100. Draw the curve f(x) = X^3/100 - x + 10, where x ranges from -10 to 10 in this fashion.

Similar Messages

Maybe you are looking for

  • Does CF offer an alternative to frames ?

    I have a web application where we need an illustration to be fixed at the top of the screen, and then row after row of database results, which offer information which references the drawing at the top of the screen. My boss has asked if there's any w

  • Apple TV 3 with hanging menus

    I have an ATV 3 (MD199KN/A), which have hanging menus after haven been on sleep. If I wants to play something from, say, Youtube, it looks like this: The cartoon keeps going in the background and going to, say, Netflix doesn't help either: My only op

  • Please fix the non-existent Sign Out

    Is there going to be any update so that you can sign out of Skype on Xbox One?  Its pretty ridiculous that you can't, I've had to go into my privacy settings and make it so no one can message me just so that Skype is disabled.  I would love to use it

  • For CF Server 9 developer win 64bit has the same running problems like 32bit, or more

    CFWACK8 reader: Better install CF Server stand alone - so no need  Apache? For CF Server 9 developer windows 64bit has the same running  problems like 32bit, or more? I have installed  http://www.apachefriends.org/en/xampp-windows.html ..WAMPP, well

  • Issues rendering WDA from portal

    Hi, When opening a WDA from portal, we encounter issues where the WDA does not seem to render and hangs. This issue occurs sporadically.  When this does occur, if re-activate the "UR" service in SICF, the issue goes away. Can anyone shed some light o