import java.applet.Applet;
import java.awt.*;

class tri{
   private int [] px = {0,0,0};
   private int [] py = {0,0,0};
 
   public void set_val(int x1, int y1, int x2, int y2, int x3, int y3){
      px[0]=x1;
      px[1]=x2;
      px[2]=x3;
      py[0]=y1;
      py[1]=y2;
      py[2]=y3;
   }// method set_val

   public void draw(Graphics page) {
   page.fillPolygon(px,py,3);
   }// method draw

}// class triangle 
public class hw3 extends Applet{

  private tri tri1, tri2;
  private Graphics page;

  public void init(){
   tri1 = new tri();
   tri2 = new tri();
   setSize(600,600);
   setVisible(true);
   page = getGraphics();
  }// method init

  public void paint(Graphics page){
   draw(page);
  }// method start

  public void draw (Graphics page){
    page.setColor(Color.blue);
    page.fillRect(0,0,600,600);
    page.setColor(Color.red);
    tri1.set_val(13,18,587,95,587,101);
    tri1.draw(page);
    tri2.set_val(30,40,200,45,300,40);
    tri2.draw(page);
  }//method draw

}// class hw3

