Centroid Assignment

To create a centroid of a triangle, you join the vertex of a triangle to the midpoint of the opposite side.

Using code from the midpoint program and the trianglesINtriangles program and your own editing, create a program that would create the following pictures - depending on what numbers you entered into the variables at the top.

Make sure that you show what the co-ordinates of the vertices are on the screen.

These variables are needed:

import java.applet.Applet;
   import java.awt.*;
public class centroid extends Applet
   {
   public void paint (Graphics g)
   {
   int x1 = 300;
   int y1 = 200;
   int x2 = 100;
   int y2 = 20;
   int x3 = 20;
   int y3 = 100;
   }
   }