Hello.

I'm currently have a task to make but i can't complete it because of my weak knowledge.
I need to draw half of sin parabola with straight lines .
Like this http://www.mif.vu.lt/matinf/asm/vs/pask/java_pr/uzd/7.jpg
It gives me a headache because i really don't like JAVA (I think it's not for me) but i need to do to get positive mark from it :D
thanks in advance for the answer.
What i need. How to make that those lines would end within the parabola top, because I can make that lines would end within parabole. They're all the same lenght

I have tried to make something, but final result doesn't look very good

import java.awt.*;
import java.applet.*;


public class Kazkband extends Applet {

    public void init() {}

    public void paint(Graphics g) {
        g.translate(110,10);
        int j=-100; 
        int i=-10;
        int v;
        while(j<=100) {
        v=i*i;
        g.drawString("J",j,v ); 
        j=j+10; i=i+1;}
        int a=-100;
        g.setColor(Color.black);
        for (int b=0;b<20; b++ )
        {
        g.drawLine(a , 0, a, 100);
        a=a+10;}
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.