JAVA CODE

//Ex3_3 program
import java.applet.Applet;
import java.awt.*;

public class Ex3_3 extends Applet
{
   public void paint (Graphics g)
   {
      int roofx[] = { 40, 70, 180, 210 };
      int roofy[] = { 70, 30, 30, 70 };
      int housex[] = { 55, 55, 195, 195 };
      int housey[] = { 70, 170, 170, 70 };
      int doorx[] = { 100, 100, 150, 150 };
      int doory[] = { 170, 120, 120, 170 };

      g.setColor (Color.red);
      g.fillPolygon (roofx, roofy, 4);
      g.setColor (Color.blue);
      g.drawPolygon (housex, housey, 4);
      g.drawPolygon (doorx, doory, 4);
   }
}