// The "GuyanaFlag" class.
import java.awt.*;
import hsa.Console;
public class GuyanaFlag
{
static Console c; // The output console
public static void main (String[] args)
{
c = new Console ();
//Background
int bw = c.maxx ();
int bh = c.maxy ();
//White triangle
int wside = 20;
//Yellow Triangle
int originx = 0;
int originy = 0;
//black triangle
int tspaces = 50;
//red triangle
int ospaces = 30;
//SIZING FACTOR
double k = 1;
//Apply the sizing factor
k = k*1;
bw = (int) Math.ceil (Math.round (k*bw));
bh = (int) Math.ceil (Math.round (k*bh));
wside = (int) Math.ceil (Math.round (k*wside));
tspaces = (int) Math.ceil (Math.round (k*tspaces));
ospaces = (int) Math.ceil (Math.round (k*ospaces));
c.setColor (Color.green);
c.fillRect (originx, originy, bw, bh);
c.setColor (Color.white);
for (int i = bh ; i >= originy ; i--)
{
c.drawLine (bw, bh / 2, originx, i + wside);
c.drawLine (bw, bh / 2, originx, i - wside);
}
c.setColor (Color.yellow);
c.drawLine (originx, originy, bw - tspaces, bh / 2);
c.drawLine (bw - tspaces, bh / 2, originx, bh);
for (int i = bh ; i >= originy ; i--)
{
c.drawLine (bw - tspaces, bh / 2, originx, i);
}
c.setColor (Color.black);
c.drawLine (originx, originy, bw / 3 + tspaces, bh / 2);
c.drawLine (bw / 3 + tspaces, bh / 2, originx, bh);
for (int i = bh ; i >= originy ; i--)
{
c.drawLine (bw / 3 + tspaces, bh / 2, originx, i);
}
c.setColor (Color.red);
c.drawLine (originx, ospaces, bw / 3, bh / 2);
c.drawLine (bw / 3, bh / 2, originx, bh - ospaces);
for (int i = bh - ospaces ; i >= ospaces ; i--)
{
c.drawLine (bw / 3, bh / 2, originx, i);
}
c.setColor (Color.black);
c.drawRect (originx, originy, bw, bh);
} // main method
} // GuyanaFlag class
|