local variables
Applet
import java.awt.*;
import java.applet.Applet;
public class TriangleMethod2 extends Applet {
public void paint(Graphics g) {
this.drawTriangle(g, 80, 200, 100, 110);
drawTriangle(g, 125, 220, 60, 70);
// did not really NEED the "this"; assumed if no instance there
}
private void drawTriangle(Graphics g, int bottomX, int bottomY, int base, int height){
int rightX = bottomX + base;
int topX = bottomX + base/2;
int topY = bottomY - height; // minus height since going UP is decreasing y value in drawing area
g.drawLine(bottomX, bottomY, rightX, bottomY);
g.drawLine(rightX, bottomY, topX, topY);
g.drawLine(topX, topY, bottomX, bottomY);
}
}