I would like to know how to make a simple graph using the method g.drawLine
and using loops to update the coordinates, I am really really new at this and have no idea what I need to do or where to start, I do have this simple program that uses *'s instead of a line to create the graph, but what I need to do is change the graph from *'s to a line. Any help would greatly be appreciated
here is what I have:
import java.awt.*;
public class program5 {
public static void main(String[] args) {
graph1();
}
public static void graph1() {
DrawingPanel panel =new DrawingPanel(300,500);
Graphics g = panel.getGraphics();
double t=10;
for (int i=1; i<20; i++) {
t= t*(.8);
double z = t * 50;
int y= -(int)z + 430;
int x = 10 * i;
g.drawString("*",x,y);
}
}
}